OpenSUSE Linux Rants

OpenSUSE Linux Tips, tricks, how-tos, opinions, and news

My Resume  -  My LinkedIn Profile - twitter: @scottmmorris

July 24, 2006

Throttling Downloads in SUSE Linux 10.1

by @ 6:37 am. Filed under General Linux, General SUSE, How-To, SUSE Tips & Tricks

Once in awhile, it’s nice to be considerate of the other users of your network. If I have a huge file that I want to download, and I just start the download, it will take up as much of the available bandwidth as it can, usually. If there were 30 people on the network, and 5 were downloading huge files all day long, the remaining 25 people would be pretty much unable to access the network.

What if you could throttle the bandwidth of your downloads? It may take a little longer, this is true. It is a nice tool to be able to implement when necessary.

How do you throttle the download bandwidth? The command you use is called wget. The syntax of this command is as follows:


wget ––limit-rate=[byte limit per second] [url]

To download the first CD of SUSE 10.1 at 20k per second, I would run this command:


wget ––limit-rate=20000 http://mirrors.kernel.org/opensuse/distribution/SL-10.1/iso/SUSE-Linux-10.1-GM-i386-CD1.iso

What’s cool is that you could write a bash script something like the following that would download the entire SUSE Linux 10.1 distribution for you completely unattended, limiting your download speed to 20k per second with a script looking like this:


#!/bin/sh
wget ––limit-rate=20000 http://mirrors.kernel.org/opensuse/distribution/SL-10.1/iso/SUSE-Linux-10.1-GM-i386-CD1.iso
wget ––limit-rate=20000 http://mirrors.kernel.org/opensuse/distribution/SL-10.1/iso/SUSE-Linux-10.1-GM-i386-CD2.iso
wget ––limit-rate=20000 http://mirrors.kernel.org/opensuse/distribution/SL-10.1/iso/SUSE-Linux-10.1-GM-i386-CD3.iso
wget ––limit-rate=20000 http://mirrors.kernel.org/opensuse/distribution/SL-10.1/iso/SUSE-Linux-10.1-GM-i386-CD4.iso
wget ––limit-rate=20000 http://mirrors.kernel.org/opensuse/distribution/SL-10.1/iso/SUSE-Linux-10.1-GM-i386-CD5.iso

Bandwidth throttling can come in very useful when you want to be considerate of the other people using your network. Also, say you were downloading SUSE 10.1. Then, you decide that you want to browse the Internet. Unthrottled, you would already be using all of your available bandwidth for your download. Browsing the Internet would be almost impossible. If you were throttling it, however, you would have at least some of your bandwidth free for browsing.

Another of the really slick ways Linux really does it for me.

If you enjoyed this post, make sure you subscribe to my RSS feed!

8 Responses to “Throttling Downloads in SUSE Linux 10.1”

  1. LenZ Says:

    To make the script a tad bit shorter, use a loop:

    #!/bin/sh
    for a in {1..5} ; do
    wget –limit-rate=20000 http://mirrors.kernel.org/opensuse/distribution/SL-10.1/iso/SUSE-Linux-10.1-GM-i386-CD$a.iso
    done

  2. Steve Dibb Says:

    If you’re downloading a huge file and want to continue it later, add -c to the argument mix. That way you can cancel and resume any time, without starting from scratch.

    wget -c -limit-rate=20000 really-large-file.foo

  3. Steve Spigarelli Says:

    Very nice article. I’ll have to use this so the download police don’t come and get me. I have never used this but will have to start.

  4. Scott Morris Says:

    Awesome, awesome comments and suggestions, everyone.
    Thanks for stopping by!

  5. Stuart Crouch Says:

    What about if you didnt think about these needs in advance? With windows I use free download manager. If someone asks me to stop hogging the bandwidth I click on the file and select a new rate.

    Is that possible with wget (to change the rate mid-download if I havent added -c or -limit-rate), is there anything in linux (gui or not) that will do it?

  6. Scott Morris Says:

    Yeah, you just abort the download with CTRL+C. Then, you reissue the command, making sure to put the “-c” option along with the –limit-rate option. It will then resume at your new desired rate.

  7. jam Says:

    good tip, however it should be –limit-rate= (note two dashes)

  8. Scott Morris Says:

    For some reason, when you put in two dashes, it combines them into an emdash. But I changed the post so it looks like 2 dashes. A direct copy-and-paste may not work, but visually, it looks more correct.

Leave a Reply

OpenSUSE Linux Rants
Official OpenSUSE Linux Site

internal links:

categories:

SUSE Resources

search blog:

rss feeds

news & syndication

archives:

September 2010
S M T W T F S
« Aug    
 1234
567891011
12131415161718
19202122232425
2627282930  

latest tweets:

33 queries. 0.516 seconds