Geoff Garbers

Husband. Programmer. Tinkerer.

Limiting download speeds with Ubuntu's apt-get

Feb 10, 2012

So, you’re on Ubuntu, and you’re needing to download and apply updates. The problem is that you’re on a shared connection, or you’re still wanting to continue browsing at a decent speed. Nobody likes a bandwidth hog, right? (hint: they don’t)

Well, thankfully, there is a way to limit bandwidth usage, even though there isn’t an easy-to-use option. The example below shows how to do this:

sudo apt-get -o  Acquire::http::Dl-Limit=50 -y dist-upgrade

Basically, the magic happens here: Acquire::http::Dl-Limit=50. That number represents the number of kilobytes to limit the bandwidth to. Change it to suit your needs.

Just to note: it doesn’t limit your bandwidth to exactly that speed. It seems to limit it to around that speed. I found that my updates ran at 54.5KB a second, when I set the download limit to 50. FYI.