Background downloading with wget

I found myself in the position earlier of wanting to download all the latest Debian CD images so I can do an install on a system with no network connectivity, then quickly discovered that this was going to take a while with my relatively slow connection (apparently 8Mb/s is good for a village in the middle of Hampshire), and having ‘wget’ use all the available bandwidth was a bit of a nuisance.

Since I’m not in any hurry I decided to see if I could limit the bandwidth that ‘wget’ uses, so it didn’t get in the way of the rest of my digital life.

Note – It you already have a set of images and just want to update them then ‘jigdo‘ is more efficient and kinder to your bandwidth as well.

# man wget
   Limit the download speed to amount bytes per second.  Amount may be
   expressed in bytes, kilobytes with the k suffix, or megabytes with
   the m suffix.  For example, --limit-rate=20k will limit the
   retrieval rate to 20KB/s.  This is useful when, for whatever
   reason, you don't want 'wget' to consume the entire available

   This option allows the use of decimal numbers, usually in
   conjunction with power suffixes; for example, --limit-rate=2.5k is
   a legal value.

   Note that 'wget' implements the limiting by sleeping the appropriate
   amount of time after a network read that took less time than
   specified by the rate.  Eventually this strategy causes the TCP
   transfer to slow down to approximately the specified rate.
   However, it may take some time for this balance to be achieved, so
   don't be surprised if limiting the rate doesn't work well with very
   small files.

Yay – That is exactly what I wanted. So to download all the Debian CD images without hogging all my bandwidth I used the following command.

# wget -r -c -b -nv\
> --limit-rate=128k

Remember the man pages are your friends.

This entry was posted in Debian, Linux, Raspbian, Ubuntu and tagged , . Bookmark the permalink.

Leave a Reply

Please log in using one of these methods to post your comment: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s