• 弃用 wget, 拥抱多线程下载 axel


    0x00 事件

    对于在 Linux 的下载工具而言,比较常用的就是 wget 或者 curl,吾也一直用 wget 的方式进行网络上的资源下载。偶然发现了 axel 这个支持多线程的下载工具,试用了几次之后,发现网络文件的下载速度提交了很多,决定将常用的下载工具替换为 axel。

    0x01 安装

    1、Linux 安装
    CentOS 中安装 axel,axel 系统不自带,且 Yum 源也没有 axel 的包,需要从网络中下载。
    可以在 https://centos.pkgs.org/ ,搜索找到并下载安装。

    $ wget http://download-ib01.fedoraproject.org/pub/epel/7/x86_64/Packages/a/axel-2.4-9.el7.x86_64.rpm
    $ rpm -ivh axel-2.4-9.el7.x86_64.rpm
    

    2、macOS 安装
    使用 brew 安装

    $ brew install axel
    

    0x02 选项参数

    --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               # 版本信息
    

    0x03 下载测试

    在同一台服务器上用官方的 CentOS Minimal ISO 镜像,分别用 wget 和 axel 做一个下载测试,文件大小 900M + 。

    $ wget http://mirror.sfo12.us.leaseweb.net/centos/7.6.1810/isos/x86_64/CentOS-7-x86_64-Minimal-1810.iso
    

    结果:
    wget 下载用时 31s。

    $ axel -n 20 http://mirror.sfo12.us.leaseweb.net/centos/7.6.1810/isos/x86_64/CentOS-7-x86_64-Minimal-1810.iso
    

    结果:
    axel 下载用时 12s。

  • 相关阅读:
    TypeError: 'encoding' is an invalid keyword argument for this function 解决Python 2.7
    valid-palindrome leetcode C++
    valid-palindrome leetcode C++
    word-break-ii leetcode C++
    word-break-ii leetcode C++
    word-break leetcoder C++
    word-break leetcoder C++
    word-ladder leetcoder C++
    word-ladder leetcoder C++
    triangle leetcode C++
  • 原文地址:https://www.cnblogs.com/nnylee/p/11363642.html
Copyright © 2020-2023  润新知