How to Select Specific Files in an aria2 Torrent

When downloading a multi-file torrent using the aria2 command-line utility, you can select specific files to download by using the --select-file parameter. This option allows you to specify the exact index numbers of the files you want to retrieve, preventing the tool from wasting time and bandwidth on unnecessary data. By leveraging this parameter alongside a few complementary commands, you can gain precise control over your torrent downloads.


Understanding the --select-file Parameter

By default, aria2 will download every single file contained within a .torrent file or magnet link. To override this behavior, you pass the --select-file option followed by a comma-separated list of file indices or ranges.

aria2c --select-file=1,3,5-7 "your_torrent_file.torrent"

In the example above, aria2 will only download the files matching indices 1, 3, 5, 6, and 7. All other files within the torrent will be ignored.


Step 1: Find the File Index Numbers

Before you can select specific files, you need to know their corresponding index numbers. You can list all the files contained within a torrent without actually starting the download by using the --show-files (or -S) parameter.

Run the following command in your terminal:

aria2c --show-files "your_torrent_file.torrent"

This will output a numbered list of all files inside the torrent. Take note of the index numbers (usually starting at 1) for the files you wish to download.


Step 2: Download Your Selection

Once you have the index numbers, pass them to the --select-file parameter to begin your targeted download.

Tip: If you are using a magnet link instead of a local .torrent file, aria2 must first download the torrent metadata before it can apply your file selection.

For a magnet link, the command structure looks like this:

aria2c --select-file=2,4 "magnet:?xt=urn:btih:EXAMPLE..."

Summary of Useful Shortcuts

Parameter Function
--show-files or -S Lists all files and their index numbers without downloading them.
--select-file=<INDEX> Downloads only the specified file indices (e.g., 1, 1-5, or 1,3,5).