Commands.page Logo

How to Prioritize Files in Torrent Downloads with aria2c on Ubuntu

This guide explains how to manage file selection and priority when downloading torrents using the aria2c command-line utility on Ubuntu. You will learn how to inspect torrent contents and specify exactly which files to download, allowing you to focus bandwidth on important data instead of retrieving every file in the package.

Install aria2

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

sudo apt update
sudo apt install aria2

Identify File Indices

Before downloading, you must identify the index numbers assigned to each file within the torrent. Use the --show-files flag followed by the path to your torrent file or magnet link.

aria2c --show-files=path/to/file.torrent

The output will list each file with a corresponding number (e.g., |uid|path|). Note the numbers associated with the files you wish to prioritize.

Download Specific Files

To prioritize specific content, instruct aria2c to download only those selected indices using the --select-file option. Separate multiple index numbers with commas.

aria2c --select-file=1,3,5 path/to/file.torrent

In this example, only files with indices 1, 3, and 5 will be downloaded. This effectively prioritizes them by excluding larger or less important files from the current session.

Enable Sequential Downloading

If you are downloading multiple selected files and want them to complete in order rather than simultaneously, enable sequential downloading. This ensures the first selected file finishes before the next begins.

aria2c --select-file=1,2 --sequential-download=true path/to/file.torrent

Adding Files Later

If you need to download the remaining files later, you cannot modify the active download directly via CLI. Instead, start a new download session for the remaining indices or use the aria2 RPC interface to modify active tasks. For most users, running a second command for the remaining file indices is the simplest approach.