aria2 – A Command Line Multi-Protocol Download Tool for Linux

aria2 is a free, open source, lightweight multi-protocol and multi-source command-line download application.

It supports HTTP/HTTPS, FTP, SFTP, BitTorrent and Metalink.

aria2 can be manipulated via built-in JSON-RPC and XML-RPC interfaces.

aria2 automatically checks chunks of the data when downloading a file.

It can download a file from multiple sources/protocols and tries to utilize your maximum download bandwidth.

By default all the Linux Distribution included aria2, so you can install easily from official repository.

Some GUI Download Manager that use aria2 as a plugin to improve download speeds, such as Uget Download Manager.

Aria2 Features

  • HTTP/HTTPS GET support
  • HTTP Proxy support
  • HTTP BASIC authentication support
  • HTTP Proxy authentication support
  • FTP support(active, passive mode)
  • FTP through HTTP proxy(GET command or tunneling)
  • Segmented download
  • Cookie support
  • It can run as a daemon process.
  • Multi-Connection Download.
  • BitTorrent protocol support with fast extension.
  • Selective download in multi-file torrent
  • Metalink version 3.0 support(HTTP/FTP/BitTorrent).
  • Limiting download/upload speed

1) How to Install aria2 on Linux

The aria2 command line download utility can be easily installed on all Linux distributions such as Debian, Ubuntu, Red Hat (RHEL), CentOS, Fedora, suse, openSUSE, ArchLinux from the official distribution repository.

For CentOS and RHEL systems you must enable the EPEL Repository in order to install the aria2 package.

For Fedora, RHEL 8 and CentOS 8 systems, use the DNF Command to install aria2.

$ sudo dnf install aria2

For Debian/Ubuntu systems, use APT-GET Command or APT Command to install aria2.

$ sudo apt install aria2

For Arch Linux based systems, use Pacman Command to install aria2.

$ sudo pacman -S aria2

For RHEL/CentOS 6/7 systems, use YUM Command to install aria2.

$ sudo yum install aria2

For openSUSE system, use Zypper Command to install aria2.

$ sudo zypper install aria2

2) How to Download Single File Using aria2 Command

The following command will download the file from the given URL and store the files in the current directory and when you download the file you will see the (date, time, download speed and download progress) of file.

# aria2c https://download.owncloud.org/community/owncloud-10.5.tar.bz2
[#986c80 19MiB/21MiB(90%) CN:1 DL:3.0MiB]
03/22 09:49:13 [NOTICE] Download complete: /opt/owncloud-10.5.tar.bz2

Download Results:
gid   |stat|avg speed  |path/URI
======+====+===========+=======================================================
986c80|OK  |   3.0MiB/s|/opt/owncloud-10.5.tar.bz2

Status Legend:
(OK):download completed.

3) How to Save a File with a Different Name Using aria2 Command

The file can be saved with a different name and format when starting the download using the -o (lowercase) option. Here we are going to save the file name with owncloud.zip.

# aria2c -o owncloud.zip https://download.owncloud.org/community/owncloud-10.5.tar.bz2
[#d31304 16MiB/21MiB(74%) CN:1 DL:6.2MiB]
03/22 09:51:02 [NOTICE] Download complete: /opt/owncloud.zip

Download Results:
gid   |stat|avg speed  |path/URI
======+====+===========+=======================================================
d31304|OK  |   7.3MiB/s|/opt/owncloud.zip

Status Legend:
(OK):download completed.

4) How to Limit Download Speed Using aria2 Command

By default aria2 uses the full bandwidth to download the file, and if the Internet is slow you will not be able to use any other functions on the server at the same time, so use the –max-download-limit option to avoid issue.

# aria2c --max-download-limit=500k https://download.owncloud.org/community/owncloud-10.5.tar.bz2
[#7f9fbf 21MiB/21MiB(99%) CN:1 DL:466KiB]
03/22 09:54:51 [NOTICE] Download complete: /opt/owncloud-10.5.tar.bz2

Download Results:
gid   |stat|avg speed  |path/URI
======+====+===========+=======================================================
7f9fbf|OK  |   462KiB/s|/opt/owncloud-10.5.tar.bz2

Status Legend:
(OK):download completed.

5) How to Download Multiple Files at Once Using the aria2 Command

The following command will download both files from the given links and save them in the current directory, where you will find the following information such as date, time, download speed and download progress when downloading the file.

# aria2c "https://download.owncloud.org/community/owncloud-9.0.0.tar.bz2" "https://download.owncloud.org/community/owncloud-10.5.tar.bz2"
[DL:1.7MiB][#53533c 272KiB/21MiB(1%)][#b52bb1 768KiB/3.6MiB(20%)]
03/22 10:25:54 [NOTICE] Download complete: /opt/owncloud-10.5.tar.bz2
[#53533c 18MiB/21MiB(86%) CN:1 DL:3.2MiB]
03/22 10:25:59 [NOTICE] Download complete: /opt/owncloud-9.0.0.tar.bz2

Download Results:
gid   |stat|avg speed  |path/URI
======+====+===========+=======================================================
b52bb1|OK  |   3.8MiB/s|/opt/owncloud-10.5.tar.bz2
53533c|OK  |   3.4MiB/s|/opt/owncloud-9.0.0.tar.bz2

Status Legend:
(OK):download completed.

Download a file from HTTP and FTP servers at the same time

# aria2c "https://download.owncloud.org/community/owncloud-10.5.tar.bz2" "ftp://ftp.gnu.org/gnu/wget/wget-1.17.tar.gz"
[DL:1.7MiB][#53533c 272KiB/21MiB(1%)][#b52bb1 768KiB/3.6MiB(20%)]
03/22 10:25:54 [NOTICE] Download complete: /opt/wget-1.17.tar.gz
[#53533c 18MiB/21MiB(86%) CN:1 DL:3.2MiB]
03/22 10:25:59 [NOTICE] Download complete: /opt/owncloud-10.5.tar.bz2

Download Results:
gid   |stat|avg speed  |path/URI
======+====+===========+=======================================================
b52bb1|OK  |   2.8MiB/s|/opt/wget-1.17.tar.gz
53533c|OK  |   3.4MiB/s|/opt/owncloud-10.5.tar.bz2

Status Legend:
(OK):download completed.

6) How to Resume an Incomplete Download Using the aria2 Command

Whenever you download a large file (eg ISO images) I advise you to use the -c option, which will help you to resume the existing incomplete download from where it stopped and finish it off as usual, when you have any network connection issue or system issues.

Otherwise, when you download it again, it will start a new download and save it in a different file name (automatically add “1” with file name).

Note: In case of any interruption, area 2 saves the current file with the extension .aria2.

# aria2c -c https://download.owncloud.org/community/owncloud-10.5.tar.bz2
[#db0b08 8.2MiB/21MiB(38%) CN:1 DL:3.1MiB ETA:4s]^C
03/22 10:09:26 [NOTICE] Shutdown sequence commencing... Press Ctrl-C again for emergency shutdown.

03/22 10:09:26 [NOTICE] Download GID#db0b08bf55d5908d not complete: /opt/owncloud-10.5.tar.bz2

Download Results:
gid   |stat|avg speed  |path/URI
======+====+===========+=======================================================
db0b08|INPR|   3.3MiB/s|/opt/owncloud-10.5.tar.bz2

Status Legend:
(INPR):download in-progress.

aria2 will resume download if the transfer is restarted.

# aria2c -c https://download.owncloud.org/community/owncloud-10.5.tar.bz2
[#873d08 21MiB/21MiB(98%) CN:1 DL:2.7MiB]
03/22 10:09:57 [NOTICE] Download complete: /opt/owncloud-10.5.tar.bz2

Download Results:
gid   |stat|avg speed  |path/URI
======+====+===========+=======================================================
873d08|OK  |   1.9MiB/s|/opt/owncloud-10.5.tar.bz2

Status Legend:
(OK):download completed.

7) How to Download Files in Bulk Using the aria2 Command

Alternatively aria2 can get a list of input URLs from a file and download them. To do so, you need to create a file and save each URL in a separate line. Add the -i option to the aria2 command to perform this operation.

# aria2c -i test-aria2.txt
[DL:3.9MiB][#b97984 192KiB/21MiB(0%)][#673c8e 2.5MiB/3.6MiB(69%)]
03/22 10:14:22 [NOTICE] Download complete: /opt/wget-1.17.tar.gz
[#b97984 19MiB/21MiB(90%) CN:1 DL:2.5MiB]
03/22 10:14:30 [NOTICE] Download complete: /opt/owncloud-10.5.tar.bz2

Download Results:
gid   |stat|avg speed  |path/URI
======+====+===========+=======================================================
673c8e|OK  |   4.3MiB/s|/opt/wget-1.17.tar.gz
b97984|OK  |   2.5MiB/s|/opt/owncloud-10.5.tar.bz2

Status Legend:
(OK):download completed.

If you want to download multiple files, you can use multiple connections with the “-x” option.

# aria2c -i test-aria2.txt -x2 -k1M

Note: The -x option specified the number of allowed connections, while the -k option specified the size of chunks.

8) How to Download a File Using Multiple Connections

The maximum number of connections to one server for each download. By default aria2 will establish one connection to each host when downloading a file. You can establish more than one connection to each host to speedup download by adding -x option with aria2 command.

I have included -x5 connections in this download.

# aria2c -x5 https://download.owncloud.org/community/owncloud-10.5.tar.bz2
[#ddd4cd 18MiB/21MiB(83%) CN:1 DL:5.0MiB]
03/22 10:16:27 [NOTICE] Download complete: /opt/owncloud-10.5.tar.bz2

Download Results:
gid   |stat|avg speed  |path/URI
======+====+===========+=======================================================
ddd4cd|OK  |   5.5MiB/s|/opt/owncloud-10.5.tar.bz2

Status Legend:
(OK):download completed.

9) How to Download a Torrent File Using the aria2 Command

The following command will download the file from the given torrent URL and store the files in the current directory and when you download the file you will see the (date, time, download speed and download progress) of file.

# aria2c https://torcache.net/torrent/C86F4E743253E0EBF3090CCFFCC9B56FA38451A3.torrent?title=[kat.cr]irudhi.suttru.2015.official.teaser.full.hd.1080p.pathi.team.sr
[#388321 0B/0B CN:1 DL:0B]                                                                                                                    
03/22 20:06:14 [NOTICE] Download complete: /opt/[kat.cr]irudhi.suttru.2015.official.teaser.full.hd.1080p.pathi.team.sr.torrent

03/22 20:06:14 [ERROR] Exception caught
Exception: [BtPostDownloadHandler.cc:98] errorCode=25 Could not parse BitTorrent metainfo

Download Results:
gid   |stat|avg speed  |path/URI
======+====+===========+=======================================================
388321|OK  |    11MiB/s|/opt/[kat.cr]irudhi.suttru.2015.official.teaser.full.hd.1080p.pathi.team.sr.torrent

Status Legend:
(OK):download completed.

Download using a local torrent file.

# aria2c file.torrent

10) How to Download BitTorrent Magnet URI Using aria2 Command

You can download a torrent file directly via the BitTorrent Magnet URI using the aria2 command as follows.

Make a note; Don’t forget to use single(‘) or double(“) quotes with BitTorrent Magnet URIs which includes “&” character.

# aria2c 'magnet:?xt=urn:btih:248D0A1CD08284299DE78D5C1ED359BB46717D8C'

11) How to Download BitTorrent Metalink Using aria2 Command

You can also download the Metalink file directly using the aria2 command.

# aria2c https://curl.haxx.se/metalink.cgi?curl=tar.bz2

12) How to Download a File from Password Protected Sites (Proxy with Authorization)

You can download a file from password protected sites using the aria2 command. To do so, use the following format.

# aria2c --http-proxy="http://username:[email protected]:8080" "https://download.owncloud.org/community/owncloud-10.5.tar.bz2"
or
# aria2c --http-proxy="http://proxy:8080" --http-proxy-user="username" --http-proxy-passwd="password" "https://download.owncloud.org/community/owncloud-10.5.tar.bz2"

13) aria2 Man Page

If you want to know the additional options for aria2 command, you can always get the details from the main page.

# man aria2c
or
# aria2c --help

Ref: aria2 examples

About Magesh Maruthamuthu

Love to play with all Linux distribution

View all posts by Magesh Maruthamuthu

6 Comments on “aria2 – A Command Line Multi-Protocol Download Tool for Linux”

  1. I use aria2 for more than a decade for my downloads. The best GUI is not Uget but Persepolis which also has windows version and a firefox extension to catch links directly from the browser. Try it and you won’t regret it. Persepolis is QT based though. For me its ok since I use KDE plasma anyway. Aria2 is by far the fastest download manager I have ever seen.

  2. Hi, may I know how to download from a local torrent file instead? I already have the .torrent file on my hard disk.

Leave a Reply

Your email address will not be published. Required fields are marked *