在 Linux 命令行下载网络文件,常用的工具是 wget,但是 wget 是单线程的,下载速度慢。
本文介绍另一款工具,axel, 以多线程的方式下载网络文件,速度更快。
axel 具有以下主要功能:
sudo apt update
sudo apt install axel
yum install axel
git clone https://github.com/axel-download-accelerator/axel.git
cd axel
./configure && make && make install
axel -n [线程数] [网络文件的地址]
如:
# 开启10个线程下载
axel -n 10 https://github.com/axel-download-accelerator/axel/archive/refs/heads/master.zip
ubuntu@ubuntu:~$ 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
--max-redirect=x Specify maximum number of redirections
--output=f -o f Specify local output file
--search[=n] -S[n] Search for mirrors and download from n servers
--ipv4 -4 Use the IPv4 protocol
--ipv6 -6 Use the IPv6 protocol
--header=x -H x Add HTTP header string
--user-agent=x -U x Set user agent
--no-proxy -N Just don't use any proxy server
--insecure -k Don't verify the SSL certificate
--no-clobber -c Skip download if file already exists
--quiet -q Leave stdout alone
--verbose -v More status information
--alternate -a Alternate progress indicator
--help -h This information
--timeout=x -T x Set I/O and connection timeout
--version -V Version information
Visit https://github.com/axel-download-accelerator/axel/issues to report bugs