How to download torrents from the command-line on Linux
Downloading data over the torrent protocol on the Linux platform can be done through the command-line. The advantage of using torrents in the terminal is that it allows users to download files to computers remotely, or even over the local network. Along with that, Linux users can easily seed files remotely, rather than having to have a client open on their machine all the time. In this tutorial, we’ll show you how to get going with downloading torrents in the command-line.
Use a VPN when downloading torrents on Linux
Though downloading data through the torrent protocol has legitimate uses, most internet service providers don’t see it that way. Many block their users from even accessing torrent protocols regardless if the content is legal or not. So, if you plan to use this app to download torrent files, we highly recommend using a VPN.
ExpressVPN takes the top spot as the best VPN reviewed by our security experts. It works well on Linux and has an excellent client for download. Better still, they offer fast download speeds with 256-bit AES encryption and perfect forward secrecy across 94 different countries. Also, they have an exclusive offer for AddictiveTips readers: 3 months free on the annual plan, a 49% discount.
Installing Aria2 on Linux
There are a few decent command-line only torrent clients for Linux. One of the best ones to use, however, is Aria2. The reason? It can handle torrent magnet links, torrent files along with other types of downloading types like FTP/SFTP, HTTP, Metalink, and more.
Installing the Aria2 client is possible on most Linux distributions quite easily. In this section of the guide, we will cover how to get the app set up and installed on Ubuntu, Debian, Arch Linux, Fedora, and OpenSUSE. We’ll also show you where to get the source code if your Linux OS doesn’t have a pre-built package available for easy installation.
Ubuntu
On Ubuntu, the Aria2 download app is available for installation in the “Universe” software repository. If you are using a version of Ubuntu Linux that doesn’t already have the “Universe” repo turned on, open up a terminal window and enter the following command.
sudo add-apt-repository universe
Next, run the update command to finish setting up the repository on Ubuntu.
sudo apt update
Finally, you can install Aria2 with:
sudo apt install aria2
Debian
Aria2 is on Debian in the “Main” software repository. To get it going, launch a terminal window and enter the following Apt-get command.
sudo apt-get install aria2
Arch Linux
On Arch Linux, you’ll find Aria2 in the “Community” software repository. To install it, ensure that the “Community” software repository is enabled in /etc/pacman.conf. Then, use the Pacman package manager to install the software.
sudo pacman -S aria2
Fedora
The Aria2 download client is in the primary Fedora Linux software sources, so it’s quite easy to install. To get it working, open up a terminal and use the Dnf command below.
sudo dnf install aria2 -y
OpenSUSE
All versions of OpenSUSE Linux have Aria2 available to users in the OSS software repository. To set it up, launch a terminal window. Then, use the Zypper package manager to download the app.
sudo zypper install aria2
Generic Linux
The source code for the Aria2 download application is available on the developer’s official website. To download it click here. For information on how to compile the program, check out the official documentation.
Download torrents from the command-line
Aria2 handles torrent files by specifying the magnet URL or torrent file. To start a download, open up a terminal window by pressing Ctrl + Alt + T or Ctrl + Shift + T.
Once a terminal is open, you can add a torrent in the following ways:
aria2c 'magnet-link'
Or
aria2c 'web-link-to-torrent-file'
Or
aria2c -T /location/of/torrent/file.torrent
When the download is complete, press the Ctrl + C keyboard combination. Pressing it will end the download and print a message letting you know where your file(s) are on your computer.
Download multiple torrents at once
Aria2 can let users download many torrent files at one time. To do it, launch a terminal like usual. Then, use the touch command to create a blank text file.
touch ~/aria2-torrents
Using the echo command, add the torrent Magnet links, Torrent file links or local files to the aria2-torrents text file.
Note: be sure to replace the torrent link with the Magnet link or Torrent file location.
echo 'torrent-link 1' >> ~/aria2-torrents echo 'torrent-link 2' >> ~/aria2-torrents echo 'torrent-link 3' >> ~/aria2-torrents
When the desired amount of torrents are added to the text file, start the download with:
aria2c -i ~/aria2-torrents
Press Ctrl + C to stop the client when the downloads are done.
Clear the text file
After downloading, it’s a good idea to clear out the text in the aria2-torrents text file. To do it, enter the following command.
echo ' ' > ~/aria2-torrents