How to Limit Wget Download Speed and Bandwidth?

This article provides a quick overview and step-by-step guide on how to restrict the download speed and bandwidth usage of the wget command-line utility. When downloading large files, wget can easily consume your entire network bandwidth, causing slowdowns for other applications and devices. By utilizing the built-in --limit-rate option, you can precisely control the maximum download speed, schedule lower-impact transfers, and maintain a stable network environment.

Understanding the --limit-rate Option

The primary method for restricting bandwidth in wget is the --limit-rate flag. This option tells wget to cap its average download speed to a specific amount per second. It is highly flexible and accepts various suffixes to denote the speed limit:

Note: wget implements this limit by sleeping the appropriate amount of time after a network read, rather than throttling the actual TCP connection at a hardware level. As a result, you might see brief spikes in speed at the very beginning of a download before the throttling adjusts.

Basic Syntax and Examples

To enforce a speed limit, append the --limit-rate flag followed by your desired speed to your standard wget command.

Limiting Speed to Kilobytes per Second

If you want to restrict a download to 500 KB/s, use the following syntax:

wget --limit-rate=500k http://example.com/largefile.zip

Limiting Speed to Megabytes per Second

To cap a high-speed download at a maximum of 2 MB/s, use the m suffix:

wget --limit-rate=2m http://example.com/movie.iso

Advanced Bandwidth Management Techniques

Beyond simply capping the speed of a single foreground download, you can combine the limit feature with other wget flags to manage background tasks and script automations efficiently.

Background Downloading with Speed Limits

If you are downloading a massive file and want to free up your terminal while ensuring the download doesn’t hijack your router, combine the background flag (-b) with the rate limit:

wget -b --limit-rate=1m http://example.com/backup.tar.gz

This creates a log file (usually wget-log) where you can check the progress without interrupting your workflow.

Creating a Permanent Speed Limit Configuration

If you routinely operate on a slow or metered connection, you can set a permanent download ceiling so you do not have to type the flag every time. This is done by editing the wget runtime configuration file.

  1. Open your user configuration file (usually located at ~/.wgetrc) in a text editor.
  2. Add the following line to the file: limit_rate = 200k
  3. Save and close the file.

Once saved, every standard wget command you run will automatically be throttled to 200 KB/s unless you explicitly override it in the command line.