Commands.page Logo

Set Aria2 Max Open Files Limit on Ubuntu

This article provides a concise guide to configuring the maximum number of open files for the aria2 download utility on Ubuntu. It details the specific command-line argument and configuration file setting needed to adjust this limit, ensuring optimal performance without exceeding system resource constraints.

The Correct Option

The option that allows aria2 to set the maximum number of open files is --max-open-files. This setting controls how many files aria2 can keep open simultaneously during a multi-file download session, such as BitTorrent or Metalink tasks.

Using the Command Line

You can apply this setting directly when running the aria2c command. Append the option followed by the desired integer value. For example, to limit open files to 50, run the following command in your Ubuntu terminal:

aria2c --max-open-files=50 "http://example.com/file.torrent"

Using the Configuration File

For a permanent setting, add the option to your aria2 configuration file. This file is typically located at ~/.aria2/aria2.conf. Open the file with a text editor and add the following line:

max-open-files=50

Remove the leading dashes when using the configuration file. Save the changes and restart any running aria2 sessions for the new limit to take effect.

System Limits

Remember that aria2 cannot exceed the open file limit imposed by the Ubuntu operating system. If you require a higher number than the default system allowance, you may need to adjust the user limit using the ulimit command before running aria2.

ulimit -n 2048

Adjusting this system-level limit ensures aria2 can utilize the --max-open-files setting without encountering errors.