aria2 is a command line tool for Linux systems that can download files using a variety of protocols, including HTTP/HTTPS, FTP, SFTP, BitTorrent and Metalink. It’s diverse download capabilities make it an all-in-one tool for downloading files on Linux.
Most users know about downloading files from the command line by using wget or curl. aria2 has a few advantages over both tools, because it has increased potential for greater download speed by downloading from more than one source in the single session. aria2 can also pause and resume downloads.
In this guide, we’ll show you how to install aria2 on major Linux distros, then give you some command line examples so you see how to download various file types with the program. By the end of this guide, you’ll know how to use aria2 to download files through various protocols, and pause or resume downloads.
In this tutorial you will learn:
- How to install aria2 on major Linux distros
- aria2 command line usage examples
- How to download a file from multiple mirrors
- How to pause or resume downloads in aria2
|Category||Requirements, Conventions or Software Version Used|
|System||Any Linux distro|
|Other||Privileged access to your Linux system as root or via the
# – requires given linux commands to be executed with root privileges either directly as a root user or by use of
$ – requires given linux commands to be executed as a regular non-privileged user
Install aria2 on major Linux distros
aria2 is available on most Linux distros from the system’s package manager. Use the appropriate command below to install it on your system.
$ sudo apt install aria2
$ sudo dnf install aria2
$ sudo pacman -S aria2
aria2 command line usage examples
aria2 uses the
aria2c command to download files. The easiest way to learn how to use this command is through examples. To get started, use some of the following commands on your own system, and you’ll eventually have it mastered and be able to all types of files using aria2.
- Just like wget, you don’t need to specify any extra options with the aria2c command to initiate a download. Simply specify the link to the file you want to grab and it will be downloaded to your present working directory.
$ aria2c https://example.com/linux-distro.iso
You can stop the download with the
Ctrl + Ckeyboard combination at any time. If you do stop the download or it gets otherwise interrupted, you can resume it by simply using the same download command again. aria2 will pick back up where it left off.
- Downloading from an FTP source follows the same syntax as above.
$ aria2c ftp://example.com/linux-distro.iso
- To potentially speed up your download, you can supply aria2 with more than one source of the same file (AKA download mirrors):
$ aria2c https://example.com/linux-distro.iso https://example.org/linux-distro.iso
- You can download a torrent in aria2 by either first downloading the .torrent file to your system, or simply passing the link to the torrent file to aria2.
$ aria2c linux-distro.torrent OR $ aria2c https://example.com/linux-distro.torrent
In the second case, aria2 will first download the .torrent file to your download directory and then start downloading data. If you do not wish for aria2 to download a torrent file, simply use the
$ aria2c --follow-torrent=mem https://example.com/linux-distro.torrent
- Metalink is a file which contains all possible sources for data to be downloaded. Which means that instead supplying aria2 with a multiple sources, we can supply just a single metalink URL or metalink file. Use the usual syntax to initiate the download, but aria2 will automatically use multiple sources to pull the file.
$ aria2c https://example.com/linux-distro.metalink
- As you may have already guessed, the syntax to download via torrent magnets is the same as it was in previous examples. All that needs to be done is to supply aria2 with a magnet link:
$ aria2c magnet:?xt=urn:btih:1e99d95f1764644a86a8e99bfd80c ...
That’s all there is to it. If you find yourself using same aria2 options again and again, to save you time you may create a configuration file and list all aria2 options that you wish to supply on the command line. To do that, open or create the aria2 configuration file located in
~/.aria2/aria2.conf and add options such as:
enable-xml-rpc follow-torrent=mem seed-ratio=2
In this guide, we saw how to install aria2 on major Linux distros and use it to download files through various protocols. We also learned how to use aria2 to stop or resume downloads, download a file from multiple sources simultaneously to speed up downloads, and configure the aria2 client with our most used options. While it’s not a perfect replacement for wget, this all-in-one tool can still be used for the majority of your download needs.