Linux 常用工具之 Axel

Axel 是 Linux 下的多线程下载工具

安装 Axel

Debian/Ubuntu/LinuxMint

1
$ sudo apt-get install axel

RHEL/CentOS

1
2
3
4
5
sudo yum install axel
➜ ~ sudo yum install axel
➜ ~ rpm -q axel
axel-2.4-9.el7.x86_64
➜ ~

Fedora

1
sudo dnf install axel

或者从源码编译,最新源码版本 axel-2.4.tar.gz

1
2
3
4
5
6
wget -c https://wilmer.gaa.st/downloads/axel-1.0b.tar.gz
tar zxvf axel-1.0b.tar.gz
cd axel-1.0b/
./configure
make
make instal

配置

Axel 的配置文件位于/etc/axelrc, 一般不需要额外配置,使用默认即可

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
➜ ~ rpm -ql axel
/etc/axelrc
/usr/bin/axel
/usr/share/doc/axel-2.4
/usr/share/doc/axel-2.4/API
/usr/share/doc/axel-2.4/CHANGES
/usr/share/doc/axel-2.4/COPYING
/usr/share/doc/axel-2.4/CREDITS
/usr/share/doc/axel-2.4/README
/usr/share/locale/de/LC_MESSAGES/axel.mo
/usr/share/locale/nl/LC_MESSAGES/axel.mo
/usr/share/locale/ru/LC_MESSAGES/axel.mo
/usr/share/locale/zh_CN/LC_MESSAGES/axel.mo
/usr/share/man/man1/axel.1.gz
/usr/share/man/zh_CN/man1/axel.1.gz
➜ ~
➜ ~ cp /etc/axelrc /tmp
➜ ~ sudo vim /etc/axelrc
➜ ~ diff /tmp/axelrc /etc/axelrc
10c10
< # reconnect_delay = 20
---
> reconnect_delay = 20
22c22
< # num_connections = 4
---
> num_connections = 4
27c27
< # connection_timeout = 45
---
> connection_timeout = 45
75c75
< # verbose = 1
---
> verbose = 0
➜ ~ grep -Ev "(^#|^$)" /etc/axelrc
reconnect_delay = 20
num_connections = 4
connection_timeout = 45
verbose = 0
➜ ~

使用

直接下载到当前目录

1
➜ ~ axel https://download.owncloud.org/community/owncloud-9.0.0.tar.bz2

指定存储路径

1
➜ ~ axel -o cloud.tar.bz2 https://download.owncloud.org/community/owncloud-9.0.0.tar.bz2

指定线程数量

1
➜ ~ axel -n 4 https://download.owncloud.org/community/owncloud-9.0.0.tar.bz2

参数
-n 指定线程数
-o 指定另存为目录
-s 指定每秒的最大比特数
-q 静默模式

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
➜ ~ axel -h
Usage: axel [options] url1 [url2] [url...]
--max-speed=x -s x Specify maximum speed (bytes per second)
--num-connections=x -n x Specify maximum number of connections
--output=f -o f Specify local output file
--search[=x] -S [x] Search for mirrors and download from x servers
--header=x -H x Add header string
--user-agent=x -U x Set user agent
--no-proxy -N Just don't use any proxy server
--quiet -q Leave stdout alone
--verbose -v More status information
--alternate -a Alternate progress indicator
--help -h This information
--version -V Version information
Visit http://axel.alioth.debian.org/ to report bugs
➜ ~

其它下载工具

aria2
wget
curl

参考资料

Axel
Axel
Speed up your downloads with Axel command line downloader/accelerator
How to Use ‘Axel’ as Download Accelerator to Speed Up FTP and HTTP Downloads
Axel – Linux下多线程下载工具

EOF