1. 程式人生 > >wget的替換工具axel多線程下載詳解

wget的替換工具axel多線程下載詳解

axel wget


1 、安裝Axel

1.1 RPM安裝Axel(方法一)

# yum localinstall ftp://195.220.108.108/linux/epel/7/x86_64/y/yum-axelget-1.0.5.1-1.20140522gitad6fb3e.el7.noarch.rpm



1.2 yum安裝Axel(方法二)

# yum install axel -y


1.3 Debian/Ubuntu安裝Axel:

$ sudo apt-get install axel

例如:

# axel [options] url1 [url2] [url...]
--max-speed=x , -s x         最高速度x
--num-connections=x , -n x   連接數x
--output=f , -o f            下載為本地文件f
--search[=x] , -S [x]        搜索鏡像
--header=x , -H x            添加頭文件字符串x(指定 HTTP header)
--user-agent=x , -U x        設置用戶代理(指定 HTTP user agent)
--no-proxy , -N             不使用代理服務器
--quiet , -q                靜默模式
--verbose ,-v               更多狀態信息
--alternate , -a            Alternate progress indicator
--help ,-h                  幫助
--version ,-V               版本信息

2、實例:

2.1、10個線程下載lnmp安裝包

# axel -n 10 -o /tmp/ 

[  1%]  .......... .......... .......... .......... ..........  [4654.5KB/s]
[  1%]  .......... .......... .......... .......... ..........  [4657.1KB/s]
[  1%]  .......... .......... .......... .......... ..........  [4656.5KB/s]
[  1%]  .......... .......... .......... .......... ..........  [4659.3KB/s]
...

2.2、限速下載:

例如限制為1MB/s的下載速度,可以看到速度基本保證在1MB以內

# axel -s 1024000 http://mirrors.btte.net/centos/7.2/isos/x86_64/CentOS-7.2-x86_64-bin-DVD1.iso 
Initializing download: http://mirrors.btte.net/centos/7.2/isos/x86_64/CentOS-7.2-x86_64-bin-DVD1.iso
File size: 4467982336 bytes
Opening output file CentOS-7.2-x86_64-bin-DVD1.iso
State file found: 30522952 bytes downloaded, 4437459384 to go.
Starting download
 
        ,,,,,,,... .......... .......... .......... ..........  [ 394.8KB/s]
[  0%]  .......... .......... .......... .......... ..........  [ 689.2KB/s]
[  0%]  .......... .......... .......... .......... ..........  [ 879.5KB/s]
[  0%]  .......... .......... .......... .......... ..........  [ 974.5KB/s]
[  0%]  .......... .......... .......... .......... ..........  [1086.4KB/s]
[  0%]  .......... .......... .......... .......... ..........  [ 967.5KB/s]
[  0%]  .......... .......... .......... .......... ..........  [ 943.8KB/s]
[  0%]  .......... .......... .......... .......... ..........  [1021.0KB/s]
[  0%]  .......... .......... .......... .......... ..........  [1066.1KB/s]

2.3、簡單進度條

默認情況下,整個屏幕都是進度條,加上-a參數,進度條類似wget

# axel -a http://mirrors.btte.net/centos/7.2/isos/x86_64/CentOS-7.2-x86_64-bin-DVD1.iso 
Initializing download: http://mirrors.btte.net/centos/7.2/isos/x86_64/CentOS-7.2-x86_64-bin-DVD1.iso
File size: 4467982336 bytes
Opening output file CentOS-7.2-x86_64-bin-DVD1.iso
Starting download
 
[  1%] [0            1           2            3           ] [   3.2MB/s] [21:47]


本文出自 “實踐出真知” 博客,請務必保留此出處http://m51cto.blog.51cto.com/53087/1959174

wget的替換工具axel多線程下載詳解