Madhav Kobal's Blog

This blog will be dedicated to Linux, Open Source and Technology news, affairs, how-tos and virtually EVERYTHING in these domains.

aria2c – Linux Command Line Download Utility

Posted by madhavkobal on 29/10/2009

aria2 is a utility for downloading files. The supported protocols are HTTP(S), FTP, BitTorrent, and Metalink. It has a powerful segmented downloading ability, downloading a file from multiple sources and multiple protocols and utilizing your download bandwidth to the maximum. It supports downloading a file from HTTP(S)/FTP and BitTorrent at the same time, while the data downloaded from HTTP(S)/FTP is uploaded to the BitTorrent swarm. Using Metalinks chunk checksums, aria2 automatically validates chunks of data while downloading a file like BitTorrent.

It continually trims out slow servers and favors faster ones, and if a file’s sources contain both HTTP(S) / FTP and BitTorrent URIs, content downloaded through HTTP(S) / FTP will be uploaded to the BitTorrent swarm.

aria2c [OPTIONS] [URL | TORRENT_FILE | METALINK_FILE]…


Examples

HTTP/FTP Segmented Download
Download a file using 1 connection
aria2c http://host/file.zip
Note
To pause a download, press Ctrl-C. You can resume the transfer by run aria2c with the same argument at the same directory. You can change URLs as long as they are pointing to the same file.
Download a file using 2 connections
aria2c -s2 http://host/file.zip
Download a file from 2 difference HTTP servers
aria2c http://host1/file.zip ftp://host2/file.zip
Download a file from HTTP and FTP servers
aria2c http://host1/file.zip ftp://host2/file.zip
Download files listed in a file concurrently
aria2c -ifiles.txt -j5
Note
-j option specifies the number of concurrent downloads.

Metalink Download

Download files with remote Metalink
aria2c --follow-metalink=mem http://host/file.metalink
Download using a local metalink file
aria2c -p -t10 --lowest-speed-limit=4000 -Mtest.metalink
Note
To pause a download, press Ctrl-C. You can resume the transfer by run aria2c with the same argument at the same directory.
Download only selected files using index
aria2c -Mtest.metalink --select-file=1-4,8
Note
The index is printed to the console using -S option.
Download a file using a local .metalink file with user preference
aria2c -Mtest.metalink --metalink-location=JP,US --metalink-version=1.1 --metalink-language=en-US

BitTorrent Download

Download files from remote BitTorrent file
aria2c --follow-bittorrent=mem http://host/file.torrent
Download using a local torrent file
aria2c --max-upload-limit=40K -Tfile.torrent
Note
--max-upload-limit specifies the max of upload rate.Note
To pause a download, press Ctrl-C. You can resume the transfer by run aria2c with the same argument at the same directory.

Download a file using torrent and HTTP/FTP server
aria2c -Ttest.torrent http://host1/file ftp://host2/file
Note
Downloading multi file torrent with HTTP/FTP is not supported.
Download only selected files using index(usually called "selectable download")
aria2c -Ttest.torrent --select-file=1-4,8
Note
The index is printed to the console using -S option.
Change the listening port for incoming peer
aria2c -Ttest.torrent --listen-port=7000-7001,8000
Note
Since aria2 doesn't configure firewall or router for port forwarding, it's up to you to do it manually.
Specify the condition to stop program after torrent download finished
aria2c -Ttest.torrent --seed-time=120 --seed-ratio=1.0
Note
In the above example, the program exists when the 120 minutes has elapsed since download completed or seed ratio reaches 1.0.
Throttle upload speed
aria2c -Ttest.torrent --max-upload-limit=100K
Enable DHT
aria2c -Ttest.torrent --enable-dht --dht-listen-port=6881
Note
DHT uses udp port. Since aria2 doesn't configure firewall or router for port forwarding, it's up to you to do it manually.

More advanced HTTP features

Load cookies
aria2c --load-cookies=cookies.txt http://host/file.zip
Note
You can use Firefox/Mozilla's cookie file without modification.
Resume download started by web browsers or another programs
aria2c -c -s2 http://host/partiallydownloadedfile.zip

And more advanced features

Throttle download speed
aria2c -Mtest.metalink --max-download-limit=100K
Repair a damaged download using --check-integrity option
aria2c -Mtest.metalink --check-integrity=true
Note
This option is only available used with BitTorrent or metalink with chunk checksums.
Drop connection if download speed is lower than specified value
aria2c -Mtest.metalink --lowest-speed-limit=10K
Parameterized URI support
You can specify set of parts:
aria2c -P http://{host1,host2,host3}/file.iso
You can specify numeric sequence:
aria2c -Z -P http://host/image[000-100].png
Note
-Z option is required if the all URIs don't point to the same file, such as the above example.You can specify step counter:

aria2c -Z -P http://host/image[A-Z:2].png
BitTorrent Encryption
Encrypt whole payload using ARC4:
aria2c -Tfile.torrent --bt-min-crypto-level=arc4 --bt-require-crypto=true

 

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

 
%d bloggers like this: