Downloading Files Quickly With aria2
At University, I have been blessed with a 1gb Ethernet connection, which is great for downloading large datasets and ISOs etc. However, I often find that the bandwidth of the server from which I am downloading a file is the limiting factor, meaning I cannot always max out the connection.
After some searching, I came across the tool aria2c, which has quickly become my wget replacement. Aria2 is a cross-platform tool that allows you to download files using multiple connections, allowing you to take full advantage of CDNs and load balancing.
Where you might normally run the command:
wget http://releases.ubuntu.com/16.04/ubuntu-16.04-desktop-amd64.iso
the aria2 equivalent is:
aria2c -x4 http://releases.ubuntu.com/16.04/ubuntu-16.04-desktop-amd64.iso
This tells aria2 to use 4 concurrent connections to download the ISO.
Aria2 supports more than just the http/https protocols — it comes with support for SFTP, BitTorrent and Metalink. Aria2 automatically detects the correct connection type based on the URL scheme. Additionally, aria2 can be controlled using remotely over an API.
As per the documentation, aria2 can be used to download batches of files. By placing a list of URLs in a text file, separated by newline, and then calling aria2c -i urls_filename.txt
, aria2 will chomp through and download each entry.
All major platforms are supported, including most flavours of Linux, OS X, Windows and Android.
Under Ubuntu/Debian, aria2 can be installed with:
sudo apt-get install aria2
under CentOS/Fedora/Scientific Linux with:
sudo yum install aria2
or under macOS (using brew) with:
brew install aria2
For other platforms, see the guide listed on the aria2 website.