The tool that usually I use to download from the command line is wget, it’s simple to use and it’s installed (or easily installable) on any system, but if you want something that can do the same job in a smarter and faster way you must really test Aria2
Aria2 is a lightweight multi-protocol & multi-source command-line download utility. It supports HTTP/HTTPS, FTP, BitTorrent and Metalink. aria2 can be manipulated via built-in JSON-RPC and XML-RPC interfaces, let’s see some practical use and examples.
Main Features of Aria2 :
Multi-Connection Download. aria2 can download a file from multiple sources/protocols and tries to utilize your maximum download bandwidth. Really speeds up your download experience.
Lightweight. aria2 doesn’t require much memory and CPU time. The physical memory usage is typically 4MiB (normal HTTP/FTP downloads) to 9MiB (BitTorrent downloads). CPU usage in BitTorrent with download speed of 2.8MiB/sec is around 6%.
Fully Featured BitTorrent Client. All features you want in BitTorrent client are available: DHT, PEX, Encryption, Magnet URI, Web-Seeding, Selective Downloads, Local Peer Discovery and UDP tracker.
Metalink Enabled. aria2 supports The Metalink Download Description Format (aka Metalink v4), Metalink version 3 and Metalink/HTTP. Metalink offers the file verification, HTTP/FTP/BitTorrent integration and the various configurations for language, location, OS, etc.
Remote Control. aria2 supports RPC interface to control the aria2 process. The supported interfaces are JSON-RPC (over HTTP and WebSocket) and XML-RPC.
For Debian/Ubuntu and Mint the package is available in the official repository so to install it I’ve simply used
apt-get install aria2
The most simple usage of aria2 from the command line is:
This will start a download of the file debian-6.0.7-amd64-netinst.iso with aria2, a nice feature that you’ll notice is that if something goes wrong and you have to interrupt the download with a ctrl-c you’ll get a message like this one:
aria2 will resume download if the transfer is restarted. If there are any errors, then see the log file. See '-l' option in help/man page for details.
Now, if you give again the download command aria2 will resume from the last bit you have downloaded in the former session.
Raise the number of connections per server
By default aria2 will start just 1 connection from every source, but this can be changed with the option
-x, so to improve the speed we could use:
aria2c -x 2 http://cdimage.debian.org/debian-cd/6.0.7/amd64/iso-cd/debian-6.0.7-amd64-netinst.iso
This will be particularly useful if with 1 connection you have not maxed out the download speed of your connection.
Download the same file from more sources
To speed up your download you can supply aria2 with more than one source of the same file:
aria2c http://cdimage.debian.org/debian-cd/6.0.7/amd64/iso-cd/debian-6.0.7-amd64-netinst.iso ftp://cdimage.debian.org/debian-cd/6.0.7/amd64/iso-cd/debian-6.0.7-amd64-netinst.iso
In this case aria2 will recognize that the file to be downloaded is same and will split the file into two parts as well as split the download to fetch from two sources and thus utilizing your download bandwidth to the maximum. In case you have provided two different files aria2 will download them both.
Downloading data using torrents is simple as downloading data via http or ftp. If you alredy have a torrent file which you want to use to fetch your data, simply supply it to aria2 as a command line argument:
With aria2 you do not even have to bother to download torrent file itself, instead simply supply torrent URL:
In this case aria2 will download the torrent file to your download directory and then start downloading data. If you do not wish aria2 to download a torrent file simplyt use –follow-torrent=mem option :
aria2c --follow-torrent=mem http://cdimage.debian.org/debian-cd/6.0.7/amd64/bt-cd/debian-6.0.7-amd64-businesscard.iso.torrent
In this case the actual torrent file will be stored into a memory only, and discarded when download is finished.
Being a full featured bittorrent client Aria2 allows you to specify the maximum upload rate when downloading torrents. This can be done with the “-u” option, such as “-u15K” would only allow an upload speed of 15KB/s.
aria2c -u15K --follow-torrent=mem http://cdimage.debian.org/debian-cd/6.0.7/amd64/bt-cd/debian-6.0.7-amd64-businesscard.iso.torrent
Aria2 is your perfect companion to download multiple protocols from the command line, it’s fast reliable and easy to use.
It should not be considered only as a wget replacement but rather as a alternative with more download options and support for the IPv6.