How to Wget: Manage network Bandwidth rate and Quota using Wget
| url: | http://linuxers.org/howto/how-wget-manage-network-bandwidth-rate-and-quota-using-wget |
|---|---|
| Date: | September 6th, 2010 at 23:31 pm |
| Author: | shredder12 |
wget bandwidth manage
While using Wget in scripts or otherwise, mostly when there is a lot of content to be downloaded, we need to set wget's network usage and bandwidth parameters. They both default to unlimited and when there is a lot of download involved, its always a good practice to set the limits. In this article, we will see how to control the bandwidth rate and total usage(quota). Limit the download bandwidth rate using Wget's --limit-rate option
Just like any other application, wget will try to use the maximum amount of bandwidth available. If you want to control the download rate of wget, then use the --limit-rate flag. Lets say you want to download some video:
[shredder12]$ wget --limit-rate=60k http://foo.bar/video.ogv
This will limit the download rate to 60 KBps. Use "m" for MBps. Wget even accepts a decimal value, e.g. 2.5. This flag is beneficial only for large files. Thats because the implementation of the rate limitation feature takes sometime to achieve the concerned limit. So, it might not appear to be working for small files.
How to Wget limit network bandwidth usage/quota using Wget's -Q option
The network quota or the total bandwidth usage can also be limited using wget's --quota or -Q attribute:
[shredder12]$ wget --quota 10m http://foo.bar/file.tgz http://foo.bar/otherfile.tgz
Please note that, if quota overflows while downloading a file then further downloading will be stopped once the current file is successfully downloaded. So, if the size of both the files are 8 and 5 MB then it will download both of them. Just like --limit-rate we can use m for Mega Bytes and similarly others. 0 sets the value to be unlimited.
