Linux运维常用工具之Axel

一 axel简介

  • https://github.com/axel-download-accelerator/axel
  • 轻量级 CLI 下载加速器

  • 多线程下载工具,下载文件时可以替代curl、wget

二 axel 安装

2.1 centos 系统

[root@wgs ~]# yum -y install axel

2.2 ubuntu 系统

  • Axel version 2.17.5 不支持ubuntu20.04
root@wgs:~# apt -y install axel

三 axel 使用帮助

root@wgs:~# axel -h
Usage: axel [options] url1 [url2] [url...]

--max-speed=x		-s x	#最大速度
--num-connections=x	-n x	#最大连接数
--max-redirect=x		Specify maximum number of redirections
--output=f		-o f	#指定文件名
--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

四 axel使用

4.1 下载镜像

[root@wgs ~]# axel http://mirrors.aliyun.com/ubuntu-releases/21.04/ubuntu-21.04-desktop-amd64.iso
Initializing download: http://mirrors.aliyun.com/ubuntu-releases/21.04/ubuntu-21.04-desktop-amd64.iso
File size: 2818738176 bytes
Opening output file ubuntu-21.04-desktop-amd64.iso
Starting download

[  0%]  .......... .......... .......... .......... ..........  [ 519.2KB/s]
[  0%]  .......... .......... .......... .......... ..........  [ 938.5KB/s]
[  0%]  .......... .......... .......... .......... ..........  [1298.6KB/s]
[  0%]  .......... .......... .......... .......... ..........  [1662.0KB/s]
[  0%]  .......... .......... .......... .......... ..........  [1856.0KB/s]
[  0%]  .......... .......... .......... .......... ..........  [2196.8KB/s]
[  0%]  .......... .......... .......... .......... ..........  [2501.3KB/s]
[  0%]  .......... .......... .......... .......... ..........  [2779.2KB/s]
[  0%]  .......... .......... .......... .......... ..........  [3124.1KB/s]
[  0%]  .......... .......... .......... .......... ..........  [3093.2KB/s]
[  0%]  .......... .......... .......... .......... ..........  [3390.2KB/s]
[  0%]  .......... .......... .......... .......... ..........  [3690.2KB/s]
[  0%]  .......... .......... .......... .......... ..........  [3990.2KB/s]
[  0%]  .......... .......... .......... .......... ..........  [4285.4KB/s]
[  0%]  .......... .......... .......... .......... ..........  [4495.9KB/s]
[  0%]  .......... .......... .......... .......... ..........  [4789.9KB/s]
[  0%]  .......... .......... .......... .......... ..........  [5060.1KB/s]
[  0%]  .......... .......... .......... .......... ..........  [4833.8KB/s]
[  0%]  .......... .......... .......... .......... ..........  [5043.4KB/s]

4.2 指定线程数下载

[root@wgs ~]# axel -n 5 http://mirrors.aliyun.com/ubuntu-releases/21.04/ubuntu-21.04-desktop-amd64.iso
Initializing download: http://mirrors.aliyun.com/ubuntu-releases/21.04/ubuntu-21.04-desktop-amd64.iso
File size: 2818738176 bytes
Opening output file ubuntu-21.04-desktop-amd64.iso
Starting download

[  0%]  .......... .......... .......... .......... ..........  [ 707.0KB/s]
[  0%]  .......... .......... .......... .......... ..........  [1004.6KB/s]
[  0%]  .......... .......... .......... .......... ..........  [1473.8KB/s]
[  0%]  .......... .......... .......... .......... ..........  [1884.1KB/s]
[  0%]  .......... .......... .......... .......... ..........  [2262.9KB/s]
[  0%]  .......... .......... .......... .......... ..........  [2707.1KB/s]
[  0%]  .......... .......... .......... .......... ..........  [2763.3KB/s]
[  0%]  .......... .......... .......... .......... ..........  [3148.7KB/s]
[  0%]  .......... .......... .......... .......... ..........  [3377.7KB/s]
[  0%]  .......... .......... .......... .......... ..........  [3727.4KB/s]
[  0%]  .......... .......... .......... .......... ..........  [4094.1KB/s]
[  0%]  .......... .......... .......... .......... ..........  [4363.3KB/s]
[  0%]  .......... .......... .......... .......... ..........  [4690.2KB/s]

4.3 设置进度条

[root@wgs ~]# axel -a http://mirrors.aliyun.com/ubuntu-releases/21.04/ubuntu-21.04-desktop-amd64.iso
Initializing download: http://mirrors.aliyun.com/ubuntu-releases/21.04/ubuntu-21.04-desktop-amd64.iso
File size: 2818738176 bytes
Opening output file ubuntu-21.04-desktop-amd64.iso
Starting download

[  3%] [0            1           2            3           ] [   6.0MB/s] [07:13]

4.4 下载限速

  • 限速1M/s
[root@wgs ~]# axel -s 1024000 -a http://mirrors.aliyun.com/ubuntu-releases/21.04/ubuntu-21.04-desktop-amd64.iso
Initializing download: http://mirrors.aliyun.com/ubuntu-releases/21.04/ubuntu-21.04-desktop-amd64.iso
File size: 2818738176 bytes
Opening output file ubuntu-21.04-desktop-amd64.iso
Starting download

[  0%] [0            1           2            3           ] [1000.3KB/s] [45:49]

 

上一篇:抽象类


下一篇:Windows 10源码一览!