axel是一个轻量级的命令行下载工具,支持多线程下载和断点续传,能够显著提升大文件的下载速度。它是Linux系统中替代wget和curl进行大文件下载的优秀工具。
sudo apt update
sudo apt install axel
sudo yum install axel
# 或使用epel源
sudo yum install epel-release
sudo yum install axel
sudo dnf install axel
brew install axel
axel [选项] [下载链接1] [下载链接2]...
| 选项 | 描述 | 默认值 |
|---|---|---|
-n, --num-connections |
指定连接数(线程数) | 4 |
-o, --output |
指定输出文件名 | - |
-s, --speed |
限制下载速度(字节/秒) | 0(无限制) |
-a, --alternate |
使用交替进度条 | 否 |
-q, --quiet |
安静模式(无输出) | 否 |
-v, --verbose |
详细输出模式 | 否 |
-S, --search |
搜索镜像并同时下载 | 否 |
--no-proxy |
不使用代理 | 否 |
-H, --header |
添加HTTP请求头 | - |
-U, --user-agent |
设置User-Agent | - |
同时使用多个连接下载同一个文件,充分利用带宽资源,显著提升下载速度。
支持下载中断后从中断点继续下载,避免重复下载已完成的文件部分。
可以从多个镜像服务器同时下载文件,自动选择最快的下载源。
下载一个文件到当前目录:
axel https://example.com/large-file.zip
默认使用4个线程进行下载。
使用10个线程加速下载:
axel -n 10 https://example.com/large-file.zip
下载文件并重命名:
axel -o my-download.zip https://example.com/large-file.zip
限制下载速度为1MB/s:
# 限制为1MB/s(1048576字节/秒)
axel -s 1048576 https://example.com/large-file.zip
# 或使用K、M、G单位
axel -s 1M https://example.com/large-file.zip
安静模式下下载文件:
axel -q https://example.com/large-file.zip
适用于脚本中的自动化下载。
同时从多个镜像下载:
axel http://mirror1.example.com/file.zip \
http://mirror2.example.com/file.zip \
http://mirror3.example.com/file.zip
如果下载中断,重新运行相同命令即可:
# 第一次下载(中断)
axel -n 8 https://example.com/huge-file.iso
# 重新执行相同的命令会自动续传
axel -n 8 https://example.com/huge-file.iso
# 1. 使用代理服务器
axel -H "Proxy-Authorization: Basic xxxxx" https://example.com/file.zip
# 2. 自定义User-Agent
axel -U "Mozilla/5.0" https://example.com/file.zip
# 3. 批量下载多个文件
axel -n 8 \
https://example.com/file1.zip \
https://example.com/file2.zip \
https://example.com/file3.zip
# 4. 结合wget使用(当axel不支持某些特性时)
# 先用axel下载,失败时使用wget
axel -n 10 https://example.com/file.zip || wget https://example.com/file.zip
# 5. 在脚本中使用(检查下载是否成功)
if axel -q -n 10 https://example.com/file.zip; then
echo "下载成功!"
else
echo "下载失败!"
fi
# 6. 下载FTP文件
axel ftp://ftp.example.com/path/to/file.zip
| 特性 | axel | wget | curl |
|---|---|---|---|
| 多线程下载 | 支持 | 不支持 | 不支持 |
| 断点续传 | 支持 | 支持 | 支持 |
| 协议支持 | HTTP, HTTPS, FTP | HTTP, HTTPS, FTP, FTPS | HTTP, HTTPS, FTP, SFTP, SCP等20+ |
| 大文件下载 | 优秀(多线程加速) | 一般(单线程) | 一般(单线程) |
| 脚本友好 | 优秀 | 优秀 | 优秀 |
-n参数时,建议从4-8开始测试最佳线程数.st临时文件,下载完成后重命名axel -n 16 \
https://mirrors.tuna.tsinghua.edu.cn/ubuntu-releases/22.04/ubuntu-22.04.3-desktop-amd64.iso
axel -n 20 -o dataset.zip \
https://datasets.example.com/large-dataset.zip