Using Trickle to Control Bandwidth Use in Any Program

There are a number of reasons why you would want to control how much bandwidth any given program is able to use. This can be done in a couple different ways, including options right with in the software, or through a software or hardware firewall. A great little program for managing bandwidth use is Trickle. Trickle runs completely in userspace, which means we don’t need to mess with a firewall, or even need root access.

If you’re on Ubuntu/Debian you should be able to install Trickle using

sudo apt-get install trickle

Now that you’ve got Trickle installed just use it before any network command to limit its bandwidth. Quite self-explanatory -u specifies upload and -d download.

trickle -u 25 -d 100 myCommand

The reason I first started using Trickle was so I could use Rsync and SCP to copy/backup files on my computer without negatively affecting the speed of my Internet connection. I have a fairly limited upload speed and this is an example of how I would limit the upload speed to 100 KB/s when backup up a folder with Rsync. Please note that when using Trickle with Rsync you have to use the -e option.

trickle -a -e "trickle -u 100 ssh" myFiles matthew@example.com:/home/matthew/backups/

It is even easier using Trickle with SCP where all you would need to do is use:

trickle -u 100 scp myFile.zip matthew@example.com:/home/matthew/backups/

Fix VIM in Ubuntu

An issue that I’ve noticed over the last couple releases of Ubuntu is that the “tiny” version of VIM is installed by default. This for me has always been a big issue, as a number of the controls in the regular VIM don’t work in the “tiny” version. Luckily for us though, this is a very easy and quick fix.
Just install the vim-gtk package using apt-get.

sudo apt-get install vim-gtk

You’ll now have the full version of VIM, as well as the GUI version.