Configure Aria2 Connections Per File on Ubuntu
This guide explains how to configure aria2 to use a specific number of connections per file on Ubuntu. You will learn how to adjust download speeds by modifying command-line arguments or editing the configuration file. Whether you need to limit bandwidth or maximize throughput, setting the correct connection count ensures optimal performance for your downloads.
Install Aria2
If you have not installed aria2 yet, open your terminal and run the following commands to update your package list and install the software:
sudo apt update
sudo apt install aria2Set Connections via Command Line
To specify the number of connections for a single download session,
use the -x flag followed by the desired number. This flag
sets the maximum number of connections to one server for each download.
You should also use the -s flag to split the file into
multiple parts to utilize those connections effectively.
Run the following command structure:
aria2c -x 16 -s 16 [URL]In this example, 16 represents the number of
connections. Replace [URL] with your actual download link.
Increasing these numbers can speed up downloads on high-bandwidth
connections, but setting them too high may cause server-side
throttling.
Set Connections via Configuration File
For a permanent setting, edit the aria2 configuration file. This ensures every download uses your preferred connection limit without typing flags each time.
- Create or open the configuration file:
bash nano ~/.aria2/aria2.conf - Add or modify the following line to set the maximum connections per
server:
text max-connection-per-server=16 - Optionally, set the split number to match:
text split=16 - Save the file and exit the editor.
Run Aria2 with Configuration
Once the configuration file is saved, run aria2 normally. It will
automatically apply the settings defined in aria2.conf:
aria2c [URL]You can verify the active settings by checking the terminal output when a download starts, which will display the number of connections being used.