Commands.page Logo

How to Limit aria2c Download Speed on Ubuntu

This article provides a concise guide on configuring aria2c to restrict download speeds on Ubuntu. By applying client-side rate limiting, you can avoid triggering server-side bandwidth caps, prevent network congestion, and ensure stable downloads when dealing with restrictive file hosts.

Install aria2

Before configuring speed limits, ensure aria2 is installed on your Ubuntu system. Open your terminal and run the following command to install the package using the default repository:

sudo apt update
sudo apt install aria2

Use the Max Download Limit Flag

The primary method to control download speed is the --max-download-limit option. This flag sets the maximum download speed per server connection. You can specify the speed in bytes per second, or use suffixes like K (kilobytes) or M (megabytes).

The basic syntax is:

aria2c --max-download-limit=VALUE [URL]

Practical Examples

To limit your download speed to 500 kilobytes per second, use the K suffix. This is useful when a server throttles connections that consume too much bandwidth too quickly.

aria2c --max-download-limit=500K https://example.com/file.zip

To limit the speed to 2 megabytes per second, use the M suffix. This ensures you do not saturate your entire internet connection while downloading large files.

aria2c --max-download-limit=2M https://example.com/file.zip

Adjusting Connections

Rate limiting works in conjunction with connection counts. If you use multiple connections (-x), the total speed may exceed the limit per connection depending on how the server handles requests. To enforce a strict total speed limit, combine the download limit with a single connection setting.

aria2c --max-download-limit=1M -x1 https://example.com/file.zip

Persistent Configuration

If you frequently need to limit speeds, you can add the setting to your aria2 configuration file so you do not need to type it every time. Edit or create the file at ~/.aria2/aria2.conf and add the following line:

max-download-limit=500K

Save the file, and all future aria2c commands will automatically adhere to this speed limit unless overridden in the command line.