lftp 进行多线程下载

lftp 进行多线程下载
cenos6、7默认yum源
yum -y install lftp
使用 lftp下载文件,指定最大连接数:
lftp -c 'pget -n10  http://10.121.x.x/test.iso'

多线程下载单个大文件
lftp -u username,password sftp@192.168.1.100 -e "pget -c -n 10 /data/centos.iso;exit"

这个适用于交互较多的场景

root@llm-server:~# lftp -u root sftp@192.168.1.100
密码: 
lftp root@a100.ciglobal.cn:~> ?                        
    !<shell-命令>                        (commands)                           alias [<name> [<value>]]
    attach [PID]                         bookmark [SUBCMD]                    cache [SUBCMD]
    cat [-b] <文件>                      cd <rdir>                            chmod [选项] 属性 文件...
    close [-a]                           [re]cls [选项] [路径/][符号]         debug [OPTS] [<level>|off]
    du [options] <dirs>                  edit [OPTS] <file>                   exit [<code>|bg]
    get [选项] <rfile> [-o <lfile>]      -b, --bytes print size in bytes      help [<cmd>]
    history -w file|-r file|-c|-l [cnt]  jobs [-v] [<job_no...>]              kill all|<job_no>
    lcd <ldir>                           lftp [OPTS] <site>                   ln [-s] <file1> <file2>
    ls [<args>]                          mget [选项] <文件>                   mirror [OPTS] [remote [local]]
    mkdir [OPTS] <dirs>                  module name [args]                   more <files>
    mput [选项] <文件>                   mrm <files>                          mv <file1> <file2>
    mmv [OPTS] <files> <target-dir>      [re]nlist [<参数>]                   open [OPTS] <site>
    pget [OPTS] <rfile> [-o <lfile>]     put [选项] <本地文件> [-o <远程文件>]
    pwd [-p]                             queue [OPTS] [<cmd>]                 quote <cmd>
    repeat [OPTS] [delay] [command]      rm [-r] [-f] <文件>                  mkdir [-f] <目录>
    scache [<session_no>]                set [选项] [<变量> [<值>]]           site <site_cmd>
    source <文件名>                      torrent [OPTS] <file|URL>...         user <用户名|URL> [<密码>]
    wait <工作号>                        zcat [-u] <文件名表>                 zmore <文件>
lftp root@a100.ciglobal.cn:~> pget -c -n 10 /data/centos.iso
2.批量下载多个文件

该操作与上一个类似,只是用的命令组件从pget变层了mget,mget支持通配符,展示如下

lftp -u username,password sftp@192.168.1.100 -e "mget /data/*.iso;exit"

这样能直接下载所有的iso文件

 

参考

https://blog.csdn.net/myiceburg/article/details/150772626 

posted @ 2024-10-25 14:13  paul_hch  阅读(122)  评论(0)    收藏  举报