Commands.page Logo

Configure aria2 Automatic File Renaming on Ubuntu

This article provides a step-by-step method to configure aria2 on Ubuntu to prevent file overwrites during downloads. It covers editing the configuration file, enabling the auto-renaming parameter, and verifying the settings to ensure distinct filenames are generated when conflicts occur.

Install aria2

If you have not installed aria2 yet, open your terminal and run the following command to install it from the Ubuntu repositories:

sudo apt update
sudo apt install aria2

Edit the Configuration File

aria2 reads settings from a configuration file located at ~/.aria2/aria2.conf. If this file does not exist, you must create it. Open the file using a text editor like nano:

nano ~/.aria2/aria2.conf

Enable Auto File Renaming

Search for the auto-file-renaming setting within the file. If it is not present, add it to the bottom. Ensure the value is set to true. This setting forces aria2 to append a suffix to the filename if a file with the same name already exists in the download directory.

auto-file-renaming=true

Save the changes and exit the editor. If you are using nano, press Ctrl+O to save and Ctrl+X to exit.

Verify the Configuration

To apply the changes, restart any running aria2 sessions or start a new download. You can verify the active configuration by running aria2 with the --show-console-readout flag or by checking the logs during a download test. When downloading a file that already exists, aria2 will now save the new file with a modified name, such as filename.1, instead of overwriting the original.