Thursday, October 11, 2012

Limit Upload/Download Speed Of APT Packages Under Ubuntu/Linux Mint/Debian

If you are sharing an internet connection with other computers connected to a local network whether at home, university, or any other place, it will be nice not to suck all the bandwidth of the network so that other users remain satisfied and happy.

Under Ubuntu, there is a useful command line tool that allows to limit download/upload speed of packages you download from the terminal or when updating repositories (apt-get update). This tool is called Trickle that allows with a few parameters to set the maximum download or upload speed in kilobytes (KB).

To install Trickle on Ubuntu, Debian or Linux Mint, run this command from the terminal:

sudo apt-get -y install trickle


   1. Updating/Upgrading Packages

Via the terminal, run this command:

sudo trickle -s -d 60 apt-get update

We use the -d 60 parameter to set max download speed. For upgrading packages, you can use one of these commands:

sudo trickle -s -d 60 apt-get dist-upgrade


sudo trickle -s -d 60 apt-get upgrade

   2. Installing APT Packages

To install a package from a repository with Trickle, run this command:

sudo trickle -s -u 45 -d 45 apt-get install pidgin

In the above command, we have set max upload and download speeds at 45 KB/s for the Pidgin package.

   3. Other Uses of Trickle

We can also use Trickle to limit download speed of files downloaded with "WGET". Here is an example:

trickle -d 70 wget

For more trickle parameters, run this command:

trickle --help