Commands.page Logo

How to Add Magnet Link to aria2c on Ubuntu Command Line

This guide explains how to use the aria2c command-line utility to download torrents via magnet links on Ubuntu. It covers installation steps, the specific command syntax required to initiate a download, and essential options for managing the process efficiently without a graphical interface.

Install aria2

Before using magnet links, ensure aria2 is installed on your system. Open your terminal and run the following commands to update your package list and install the software:

sudo apt update
sudo apt install aria2

To start a download, use the aria2c command followed by the magnet link enclosed in quotes. Using quotes prevents the shell from misinterpreting special characters within the link.

aria2c "magnet:?xt=urn:btih:HASH&dn=NAME"

Replace the example string above with your actual magnet link. The download will begin immediately in the current directory.

Useful Options

You can customize the download behavior with specific flags. To specify a different download directory, use the -d option. To increase download speed by allowing more connections per server, use the -x and -s options.

aria2c -d ~/Downloads -x 16 -s 16 "magnet_link_here"

Monitor Progress

aria2c displays real-time progress in the terminal by default. If you need to pause the download, press Ctrl+C. To resume later, simply run the same command again, as aria2c supports continuation automatically.