Command-Line Downloading Using aria2

by

Please shareShare on Facebook32Share on Google+6Tweet about this on Twitter14Share on LinkedIn1Share on Reddit0Digg thisShare on StumbleUpon0Share on VKBuffer this page

All Linux distributions come with wget pre-packaged by default. Sure, wget does do the job, but there is an alternative which I believe does a much better job at downloading from the command-line. aria2 is available in the repositories from most mainstream distributions.

To install aria2 in Ubuntu or Linux Mint, just perform the following:

% sudo apt-get install aria2

Once aria2 has downloaded and installed, you are now ready to begin downloading from the command-line.

It important to keep in mind aria2 will download your file to the location of where you are currently sitting in you CLI. For example when you first open a terminal, it will be running in the home directory ~/

It’s a good idea to change to the Downloads directory and then proceed with your download:

% cd Downloads

And now you are ready to download your file using aria2. When you have to the download link of the file you wish to source, highlight it in your browser and then copy the text. Then switch back to your terminal and enter the following command, followed by pasting the copied link in to the command:

% aria2c http://thewebsite/downloads/thefile.iso

This will now start downloading your file to the Downloads directory. aria2 can also download FTP server links.

% aria2c ftp://thewebsite/downloads/thefile.iso

There is a really cool trick you can do to increase your download speeds, if not increase the speed, it will at least spread the connection across several different servers therefore making your total overall connection that little bit more efficient.

aria2 can download files from two different sources at once. Try enter the same command but with both links. And it works for either HTTP or FTP. Or even a mix of both protocols:

% aria2c http://thewebsite/downloads/thefile.iso http://thesecondwebsite/downloads/thefile.iso
% aria2c http://thewebsite/downloads/thefile.iso ftp://thewebsite/downloads/thefile.iso

You can also download from the same mirror but with 2 simultaneous connections:

% aria2c -x2 http://thewebsite/downloads/thefile.iso

aria2 is also capable of downloading files via Bittorrent. You can easily do this by entering the command like this:

% aria2c http://thewebsite/downloads/thefile.torrent

Or even use for magnet links:

% aria2c <copy the magnet link here>

There is a lot of options for the torrent-side of aria2. It supports all the usual torrent options such as DHT, PEX, encryption and tracker support. But I highly recommend you read the man pages for advanced torrent usage in aria2 as the amount of different options available are mind boggling and too in-depth to show you in this article.

The above are all just simple commands for simple usage in aria2. It does a hell of a lot more with links. It’s worth taking a look at the man page, which provides the user with really good informative and easy to follow information on what commands do what and its available arguments.

I’ve been using a combination of wget and aria2 for many years. I swear by it. And once you get used to its commands and abilities, you’ll be downloading from the command-line in no time.