How to download torrents from command line in Ubuntu

Most torrenting on Linux is done through graphical clients. However, you might be interested to know that it's also possible to download torrents directly inside Terminal.

Even though torrent doesn't have the best reputation, there are still a lot of positives to using it. For starters, if you like to share files, it's a great way to outsource your bandwidth. No longer having to host a download server. Just offer the torrent to your community and ask them to seed it! Low bandwidth costs and fast transmission for everyone!

Most torrenting on Linux is done through graphical clients. However, you might be interested to know that it's also possible to download torrents directly inside Terminal. This article will show you how to download torrents in the latest Ubuntu LTS.

Install CLI Torrent Client on Ubuntu

There are many good CLI-based torrent clients, but few are as good as transmission-cli. This is the easiest to use out of all the options available and is similar to the most used torrent client on Linux (Transmission).

To install transmission-cli, open a terminal window and enter the following command:

sudo apt install transmission-cli

Add torrents in Transmission

Adding torrents to transmission-cli is quite simple. Start by finding torrent files from your favorite torrent distributor. This tutorial will use the Ubuntu MATE LTS release torrent.

Download torrents by URL

Transmission CLI can download torrents directly from a URL by executing the command:

transmission-cli https://cdimage.ubuntu.com/ubuntu-mate/releases/22.04/release/ubuntu-mate-22.04.3-desktop-amd64.iso.torrent -w ~/Downloads

How to download torrents from command line in Ubuntu Picture 1How to download torrents from command line in Ubuntu Picture 1

 

This method is great if the user is having difficulty and just wants the download to happen as soon as possible.

Download torrent using magnet link

Transmission CLI torrent client also supports magnet links. To download torrents using magnet links, try the following:

transmission-cli magnet:?xt=urn:btih:0223dcb7785d09dbdff5839a089774277a66b4c9&dn=ubuntu-mate-22.04.3-desktop-amd64.iso -w ~/Downloads

Download Torrent using torrent file

And finally, Transmission CLI can initiate downloads via local torrent files. Get the torrent file by normal means (through a web browser) or find a link to the torrent file and download it via Terminal using wget.

For example:

wget https://cdimage.ubuntu.com/ubuntu-mate/releases/22.04/release/ubuntu-mate-22.04.3-desktop-amd64.iso.torrent

To download using a torrent file, do the following:

transmission-cli ./ubuntu-mate-22.04.3-desktop-amd64.iso.torrent -w ~/Downloads

Activate peer block list

Since transmission-cli works differently from its graphical version, it often does not save settings. This means you need to specify your peer block list every time you download a torrent to Ubuntu. Flag -b enables the blocklist. To use a block list during downloads, follow this example:

transmission-cli https://cdimage.ubuntu.com/ubuntu-mate/releases/22.04/release/ubuntu-mate-22.04.3-desktop-amd64.iso.torrent -w ~/Downloads -b https://mirror .codebucket.de/transmission/blocklist.p2p.gz

How to download torrents from command line in Ubuntu Picture 2How to download torrents from command line in Ubuntu Picture 2

 

Download torrents with encryption

Although it is not recommended to download sketchy files from torrents, it still happens. To protect yourself when downloading these types of files, you can encrypt your traffic while torrenting on Ubuntu. Here's how:

transmission-cli https://cdimage.ubuntu.com/ubuntu-mate/releases/22.04/release/ubuntu-mate-22.04.3-desktop-amd64.iso.torrent -w ~/Downloads -er

The -er flag tells transmission-cli that it requires encryption for all peers it connects to. This can slow down transfer speeds, so this option may not be for everyone, especially those with slow connections.

To download with encrypted traffic but also increase your transfer speed, try using the -ep flag instead. This will tell the peer that the client prefers encryption, but it will not require it.

transmission-cli https://cdimage.ubuntu.com/ubuntu-mate/releases/22.04/release/ubuntu-mate-22.04.3-desktop-amd64.iso.torrent -w ~/Downloads -ep

How to download torrents from command line in Ubuntu Picture 3How to download torrents from command line in Ubuntu Picture 3

Explore other Transmission flags

Transmission-cli is full of different types of options. To see these options, run transmission-cli --help. Doing so will output various flags and command modifications that users can add to their transmission-cli command for a better download experience. For example, you can enter transmission-cli -d 800 to limit total client throughput to 800 kilobytes per second.

How to download torrents from command line in Ubuntu Picture 4How to download torrents from command line in Ubuntu Picture 4

Download torrents using rTorrent

Besides Transmission CLI, you can also use other torrent client terminals to manage your torrent downloads. These are typically Terminal-only tools, meaning they contain features geared toward user automation and macros.

rTorrent is a popular TUI torrent client that allows you to automatically handle share rates, TOR, and automatically extract torrent files from websites. To install it in Ubuntu, run the following command:

sudo apt install rtorrent

To add torrent files to rTorrent, open a new terminal and run rtorrent. This will load the client's TUI and take up the entire Terminal screen.

How to download torrents from command line in Ubuntu Picture 5How to download torrents from command line in Ubuntu Picture 5

Press Enter to open the torrent prompt, then enter the path to your torrent file. This can be a local '.torrent' file or a remote link.

How to download torrents from command line in Ubuntu Picture 6How to download torrents from command line in Ubuntu Picture 6

Press the Down Arrow key to select the first torrent file, then press Ctrl + S to start downloading your new torrent.

How to download torrents from command line in Ubuntu Picture 7How to download torrents from command line in Ubuntu Picture 7

Download torrents with aria2c

Aria2c is a lightweight and highly minimalist download manager for Linux. Unlike Transmission and rTorrent, aria2c is a multi-protocol download client, meaning you can also use it to download non-torrent files. You can download aria2c by running the following command:

sudo apt install aria2c

To download torrents using aria2c, run the program, followed by the path of the '.torrent' file you want to download. Like in rTorrent, this can be a local or remote path:

aria2c https://cdimage.ubuntu.com/ubuntu-mate/releases/22.04/release/ubuntu-mate-22.04.3-desktop-amd64.iso.torrent

You can also download torrent files directly in aria2c using their magnet link:

aria2c magnet:?xt=urn:btih:0223dcb7785d09dbdff5839a089774277a66b4c9&dn=ubuntu-mate-22.04.3-desktop-amd64.iso

While downloading using a command instead of a fancy GUI may not seem very appealing, you'd be wrong. For example, Transmission CLI has more features than most conventional graphical clients. Meanwhile, rTorrent and aria2c are also great alternatives that offer unique features like rate handling and multi-protocol support.

5 ★ | 1 Vote