How to use Aria2 to download files in Linux

Guide Aria2 is a free, open source, lightweight multi-protocol command line utility that can download files from the Internet. It supports various protocols such as HTTP, HTTPS, FTP and even BitTorrent. Aria2 can run on Windows, Linux and Mac OSX.

Main features

The following are the main features of Aria2:

1) Less resource usage: Aria2 is very lightweight and occupies a small portion of CPU and memory. Normal FTP/HTTP downloads occupy about 4MB of memory, and BitTorrent downloads occupy about 9MB of memory.

2) Multi-connection download: Aria2 is a multi-protocol download tool that supports multiple protocols and tries to use the maximum bandwidth as much as possible to speed up the download.

3) Remote control: Aria2 supports RPC interface, more specifically JSON-RPC and XML-RPC.

4) Full-featured BT functions: These functions include torrent files, magnetic links, encryption, selective download and local peer-to-peer discovery, etc.

Install Aria2

Install Aria2 in Ubuntu /Deepin:

$ sudo apt install aria2

Install Aria2 in Centos 7/8:

# yum -y install epel-release
# yum -y install aria2

Install Aria2 in Arch/Manjaro:

$ sudo pacman -S aria2

Aria2 use case

Here are some usages of the Aria2 command line tool.

1. Download a single file through the network

grammar:

# aria2c URL

Download the Linux version of QQ as an example, and run the following command:

[root@localhost ~]# aria2c http://down.qq.com/qqweb/LinuxQQ/linuxqq_2.0.0-b2-1084_x86_64.rpm

How to use Aria2 to download files in Linux How to use Aria2 to download files in Linux

2. Save the file under another name after downloading

To save the file under another name, please use the -ooption, as shown below, change the file name to linux-qq.rpm:

[root@localhost ~]# aria2c -o linux-qq.rpm http://down.qq.com/qqweb/LinuxQQ/linuxqq_2.0.0-b2-1084_x86_64.rpm

How to use Aria2 to download files in Linux How to use Aria2 to download files in Linux

3. Download multiple files

To download multiple files, please use the -Zoption, and then follow the URL address of the file to be downloaded. The following examples download the Linux version of qq and the Linux version of the sunflower command line client.

[root@localhost ~]# aria2c -Z linux-qq.rpm http://down.qq.com/qqweb/LinuxQQ/linuxqq_2.0.0-b2-1084_x86_64.rpm https://down.oray.com/sunlogin/linux/sunloginclientshell-10.1.1.28779.x86_64.rpm

How to use Aria2 to download files in Linux How to use Aria2 to download files in Linux

4. Download files from the list

You can create a file and list all file URLs in it instead of listing all file URL addresses on the terminal. You can use -ioptions. The following example downloads multiple files. First look at the file that stores the URL address:

[root@localhost ~]# cat pic_download.txt 
https://www.linuxprobe.com/wp-content/uploads/2021/01/windows7.png
https://www.linuxprobe.com/wp-content/uploads/2016/12/bigdata.jpg
https://www.linuxprobe.com/wp-content/uploads/2021/01/write-games-and-learn-python.jpg
https://www.linuxprobe.com/wp-content/uploads/2021/01/data-center-inspection.jpg
https://www.linuxprobe.com/wp-content/uploads/2020/03/devolop-like-linux-09.jpg

How to use Aria2 to download files in Linux How to use Aria2 to download files in Linux
Then use the -ioption to download it:

[root@localhost ~]# aria2c -i pic_download.txt 

How to use Aria2 to download files in Linux How to use Aria2 to download files in Linux

5. Limit download speed

By default, aria2 uses the maximum bandwidth to download files. You can use --max-download-limitoptions to limit the bandwidth, the download speed is limited to 100K below. :

[root@localhost ~]# aria2c --max-download-limit=100K http://down.qq.com/qqweb/LinuxQQ/linuxqq_2.0.0-b2-1084_x86_64.rpm

How to use Aria2 to download files in Linux How to use Aria2 to download files in Linux

6. Resume uploading

You can use -coptions to continue downloading files that have not been downloaded:

[root@localhost ~]# aria2c -c --max-download-limit=100K http://down.qq.com/qqweb/LinuxQQ/linuxqq_2.0.0-b2-1084_x86_64.rpm

How to use Aria2 to download files in Linux How to use Aria2 to download files in Linux
Currently this option is only applicable to HTTP(S)/FTP downloads.

7. Download magnetic link files

To download a magnetic link file, if the download does not have a speed, you can add an --bt-tracker=option, followed by the address of the world tracker, followed by the BT seed or magnetic link address:

[root@localhost ~]# aria2c --bt-tracker=udp://tracker.opentrackr.org:1337/announce,udp://tracker.cyberia.is:6969/announce,udp://exodus.desync.com:6969/announce,udp://3rt.tace.ru:60889/announce,http://5rt.tace.ru:60889/announce,udp://tracker.internetwarriors.net:1337/announce magnet:?xt=urn:btih:45521E5D3C26890BAAA2928BC511D1BE88074518&dn=cn_windows_10_business_editions_version_20h2_updated_dec_2020_x64_dvd_547eb680.iso&xl=5982177280 

How to use Aria2 to download files in Linux How to use Aria2 to download files in Linux
As you can see, the download speed is still very fast.

Tips: Tracker address is available in github. If there is no speed, you can change several tracker addresses. https://github.com/ngosang/trackerslist/blob/master/trackers_best.txt. Each address is ,separated by a comma.

to sum up

Aria2 is a free, open source, lightweight multi-protocol command line utility that can download files from the Internet. It supports various protocols such as HTTP, HTTPS, FTP and even BitTorrent. Aria2 can run on Windows, Linux and Mac OSX. Linux should be learned like this

Guess you like

Origin blog.csdn.net/Linuxprobe18/article/details/112978017