How to Download .torrent Files Using aria2?

This guide provides a straightforward walkthrough on how to initiate a BitTorrent download using a local .torrent file with aria2, a lightweight, multi-protocol command-line download utility. You will learn the basic command syntax, essential configuration options for managing bandwidth and ports, and how to run the download seamlessly in the background.


The Basic Command

To start a BitTorrent download in aria2 with a file already saved on your computer, open your terminal or command prompt and use the following basic syntax:

aria2c /path/to/file.torrent

For example, if your file is named ubuntu.torrent and is located in your current working directory, simply run:

aria2c ubuntu.torrent

Once executed, aria2 will automatically parse the file, connect to the trackers or DHT network, and begin downloading the files to your current directory.

Choosing a Specific Download Directory

By default, aria2 saves the downloaded content into the directory where you ran the command. If you want to save the files to a specific folder, use the -d (or --dir) option:

aria2c -d /path/to/download/folder ubuntu.torrent

Managing Bandwidth and Speed Limits

Torrenting can easily consume your entire internet bandwidth. You can cap the maximum download and upload speeds using the --max-download-limit and --max-upload-limit flags.

Configuring Ports and Seeding Limits

To ensure optimal connectivity, you can define specific listening ports for the BitTorrent traffic using the --peer-agent or --listen-port options.

aria2c --listen-port=6881-6889 ubuntu.torrent

BitTorrent etiquette requires sharing back what you download. However, if you want to control when aria2 stops seeding, you can set a specific seeding ratio or time limit:

Running aria2 in the Background

If you are working on a remote server or want to close your terminal without stopping the download, you can run aria2 as a background daemon using the -D flag:

aria2c -D ubuntu.torrent