Commands.page Logo

Set aria2 Default Download Directory on Ubuntu

This article provides a step-by-step guide to configuring the aria2 download utility on Ubuntu to save files to a specific folder by default. You will learn how to create a configuration file, set the directory path, and verify the settings using the command line interface.

Install aria2

Ensure aria2 is installed on your system. Open your terminal and run the following command:

sudo apt update
sudo apt install aria2

Create the Configuration File

aria2 reads settings from a configuration file located in your home directory. Create the necessary directory and file using these commands:

mkdir -p ~/.aria2
touch ~/.aria2/aria2.conf

Set the Default Directory

Open the configuration file in a text editor like nano:

nano ~/.aria2/aria2.conf

Add the following line to specify your desired download path. Replace /home/username/Downloads with your actual preferred directory:

dir=/home/username/Downloads

Save the file and exit the editor.

Verify the Configuration

You can test the setting by running a download command. aria2 will automatically use the path defined in your configuration file:

aria2c http://example.com/file.zip

To check the current configuration settings without downloading, use the print command:

aria2c --print-conf | grep dir

Using Command Line Arguments

If you need to override the default directory for a single download, use the -d flag followed by the path:

aria2c -d /tmp http://example.com/file.zip

This method ensures your downloads are organized automatically while allowing flexibility when needed.