Commands.page Logo

Aria2 Command to Save Download Progress Session File

This guide explains how to configure the aria2 download utility on Ubuntu to preserve download states. It identifies the specific command flags required to generate a session file, enabling users to resume interrupted transfers efficiently without losing progress.

To generate a session file, you must use the aria2c command with the --save-session option. This flag specifies the path where aria2 will save the status of active downloads. The session file is typically written when aria2 exits successfully or when forced to stop.

Use the following command structure to start a download and create a session file:

aria2c --save-session=/home/user/downloads/session.dat [URL]

To ensure progress is saved periodically during the download process rather than only upon completion, add the --save-session-interval option. This saves the session file every specified number of seconds.

aria2c --save-session=/home/user/downloads/session.dat --save-session-interval=60 [URL]

To resume a download using the generated session file, use the --input-file option instead of specifying the URL again. This tells aria2 to read the pending downloads from the session file.

aria2c --input-file=/home/user/downloads/session.dat

For permanent configuration, you can add these settings to your aria2 configuration file located at ~/.aria2/aria2.conf. Add the following lines to automatically save session data for every download task:

save-session=/home/user/downloads/session.dat
save-session-interval=60
input-file=/home/user/downloads/session.dat

This setup ensures that all download progress is preserved automatically on your Ubuntu system.