怎么做物流网站,网站设计风格升级,东京购物商城,建设营销型网站有哪些步骤目录 0. ftp vs. lftp1. 安装2. 常用命令2.1 登录2.2 文件管理2.3 文件传输 3. 脚本编程4. 实践中的问题排查参考 0. ftp vs. lftp
lftp是一款文件传输工具#xff0c;支持FTP、HTTP、SFTP、FISH等多种协议。
功能ftplftp数据传输文件文件、文件夹多线程传输支持断点续传支持… 目录 0. ftp vs. lftp1. 安装2. 常用命令2.1 登录2.2 文件管理2.3 文件传输 3. 脚本编程4. 实践中的问题排查参考 0. ftp vs. lftp
lftp是一款文件传输工具支持FTP、HTTP、SFTP、FISH等多种协议。
功能ftplftp数据传输文件文件、文件夹多线程传输支持断点续传支持脚本编程支持后台执行任务支持
1. 安装
# 方法1. conda
conda install lftp# 方法2. centos root
yum install lftp2. 常用命令
2.1 登录
lftp ftp://[user:password]site[:port]lftp -u user,password ftp.example.com2.2 文件管理
命令功能pwd / lpwd显示远端/本地所在目录ls / !ls显示远端/本地文件列表cd / lcd切换远端/本地目录mv移动远端文件rm删除远端文件mrm删除多个远端文件支持通配符mkdir建立远端目录rmdir删除远端目录du计算远端目录大小exit退出ftp
2.3 文件传输
命令功能get下载远端文件mget下载远端文件支持通配符 *pget下载远端文件支持多线程reget断点续传mirror同步目录put上传文件mput上传文件支持通配符*reput断点续传
数据下载示例
get remote-file [local-file] #如省略本地文件名则默认使用远程文件的文件名
mget -c *.db # 把所有的db文件以允许断点续传的方式下载
pget -c -n 10 10G.file 以最多10个线程以允许断点续传的方式下载10G.file
mirror aaa/ # 将aaa目录整个的下载下来子目录也会自动复制数据上传示例
put local-file [remote-file] #如省略远程文件名则默认使用本地文件的文件名
put linux265.tar
mirror -R 本地目录名 #将本地目录以迭代包括子目录的方式反向上传到ftp站点数据同步示例
lftp -e mirror -c -e -P20 --verbose /remote/path /local/path;quit; ftp.government.gov
#lftp -e : 执行引号中的命令
#mirror: lftp同步命令
##-c: 断点续传该参数不能和-n一起使用
##-e: 删除远程目录上不存在文件
##--parallel: 并行下载多个文件
##--verbose: 打印日志信息#扩展可结合cronb实现定时同步Linux / Unix lftp Command To Mirror Files and Directories Mirroring an FTP Using lftp and cron
3. 脚本编程
lftp -u username,password ftp.example.com -p 21
lftp -u username,password ftp.example.com -c ls
lftp -u username,password ftp.example.com -e cd /path/to/a; put file.txt; quit
lftp -u username,password ftp.example.com -e mirror /remote/dir /local/dir; quit#!/bin/bash
HOSTftp.example.com
USERyourusername
PASSyourpasswordlftp -u ${USER},${PASS} ${HOST} EOF
cd /path/to/destination
limit-rate 200KB/s
put /path/to/localfile
exit
EOF4. 实践中的问题排查
lftp -u myuser,mypassword 1.2.3.4 -p 5555
ls
ls at 0 [FEAT negotiation...] # Q1. FEAT negotiation# A1. use sftp protocol
lftp -u myuser,mypassword sftp://1.2.3.4 -p 5555
ls
ls: Fatal error: Host key verification failed. # Q2.Host key verification# A2. added RSA to the list of known hosts
ssh -p 5555 myuser1.2.3.4
#Are you sure you want to continue connecting (yes/no/[fingerprint])? yes
#ctrlC终止即可lftp -u myuser,mypassword sftp://1.2.3.4 -p 5555
ls #恢复正常参考
lftp命令 LFTP 命令行工具常见用法大全详解 LFTP: how to fix the “Fatal error: Host key verification failed” error