歡迎來到Linux教程網
Linux教程網
Linux教程網
Linux教程網
Linux教程網 >> Linux基礎 >> Linux教程 >> LFTP 軟件詳解

LFTP 軟件詳解

日期:2017/2/28 14:43:48   编辑:Linux教程

lftp是一個支持下載,上傳同時還有支持screen用法的工具,相當於ftp的客戶端,有它支持訪問文件的協議有: ftp, ftps, http, https, hftp, fish
1.登陸的方式:
lftp 用戶名:密碼@ip地址
[root@zhu2 ~]# lftp zhu:[email protected]
lftp [email protected]:~> ls -l
drwxr-xr-x 9 500 500 4096 Sep 09 16:02 LVS
-rw-r--r-- 1 500 500 0 Sep 09 15:52 txt1

lftp 用戶名@ip地址
lftp 192.168.70.137:~> bye
[root@zhu2 ~]# lftp [email protected]
口令:
lftp [email protected]:~> ls -l
drwxr-xr-x 9 500 500 4096 Sep 09 16:02 LVS
-rw-r--r-- 1 500 500 0 Sep 09 15:52 txt1

lftp ip地址 -p 端口號 -u 用戶,密碼

[root@zhu2 ~]# lftp 192.168.70.137 -u zhu,123456
lftp [email protected]:~>

lftp ip地址:端口 -u 用戶,密碼

[root@zhu2 ~]# lftp 192.168.70.137:21 -u zhu,123456
lftp [email protected]:~>

2.常用指令
help :查看文件列表

lftp [email protected]:~> help
!<shell-command> (commands)
alias [<name> [<value>]] anon
bookmark [SUBCMD] cache [SUBCMD]
cat [-b] <files> cd <rdir>
chmod [OPTS] mode file... close [-a]
[re]cls [opts] [path/][pattern] debug [<level>|off] [-o <file>]
du [options] <dirs> exit [<code>|bg]
get [OPTS] <rfile> [-o <lfile>] glob [OPTS] <cmd> <args>
help [<cmd>] history -w file|-r file|-c|-l [cnt]
jobs [-v] kill all|<job_no>
lcd <ldir> lftp [OPTS] <site>
ls [<args>] mget [OPTS] <files>
mirror [OPTS] [remote [local]] mkdir [-p] <dirs>
module name [args] more <files>
mput [OPTS] <files> mrm <files>
mv <file1> <file2> [re]nlist [<args>]
open [OPTS] <site> pget [OPTS] <rfile> [-o <lfile>]
put [OPTS] <lfile> [-o <rfile>] pwd [-p]
queue [OPTS] [<cmd>] quote <cmd>
repeat [OPTS] [delay] [command] rm [-r] [-f] <files>
rmdir [-f] <dirs> scache [<session_no>]
set [OPT] [<var> [<val>]] site <site_cmd>
source <file> user <user|URL> [<pass>]
version wait [<jobno>]
zcat <files> zmore <files>
lftp [email protected]:~>

ls :查看遠程主機上的文件或目錄
!ls:查看本地所在的目錄下的文件列表

lftp [email protected]:~> ls
drwxr-xr-x 9 500 500 4096 Sep 09 16:02 LVS
-rw-r--r-- 1 500 500 0 Sep 09 15:52 txt1
lftp [email protected]:~> !ls
iptables lnmp LVS

pwd :顯示所在的遠程主機上的目錄
lpwd :顯示的是本地的所在目錄
lftp [email protected]:~> pwd
ftp://zhu:[email protected]:21/%2Fhome/zhu
lftp [email protected]:~> lpwd
/root

cd :切換遠程主機的目錄
lcd:切換本地的目錄
lftp [email protected]:~> pwd
ftp://zhu:[email protected]:21/%2Fhome/zhu
lftp [email protected]:~> lpwd
/root
lftp [email protected]:~> cd lvs
lftp [email protected]:~/lvs> pwd
ftp://zhu:[email protected]:21/%2Fhome/zhu/lvs
lftp [email protected]:~/lvs> lcd /root/iptables/
lcd 成功, 本地目錄=/root/iptables
lftp [email protected]:~/lvs> lpwd
/root/iptables

get 文件名 :下載單個文件到本地所在的當前目錄
lftp [email protected]:~> get txt1
lftp [email protected]:~> !ls
iptables lnmp LVS txt1

mget (支持通配符,可同時下載多個文件)
lftp [email protected]:~/lvs> mget auto*
3429843 bytes transferred
Total 2 files transferred
lftp [email protected]:~/lvs> !ls
autoconf-2.68.tar.gz automake-1.11.2.tar.gz iptables lnmp LVS txt1


put 文件名 :上傳本地的某個文件到遠程主機的當前所在目錄
lftp [email protected]:~> put zabbix_sender.py
2764 bytes transferred
lftp [email protected]:~> ls -l
drwxr-xr-x 9 500 500 4096 Sep 09 16:02 lvs
-rw-r--r-- 1 500 500 0 Sep 09 15:52 txt1
-rw-r--r-- 1 500 500 2764 Sep 09 17:35 zabbix_sender.py
-rw-r--r-- 1 0 0 0 Sep 09 17:32 zhujiangtao
drwxr-xr-x 2 0 0 4096 Sep 09 17:32 zhuzhu


mput :同時上傳多個文件支持通配符

lftp [email protected]:~> mput check*
14908 bytes transferred
Total 2 files transferred
lftp [email protected]:~> ls -l
-rw-r--r-- 1 500 500 585 Sep 09 17:35 checkSYSConfig.ini
-rw-r--r-- 1 500 500 14323 Sep 09 17:35 checklastLoginAndipTables.py
drwxr-xr-x 9 500 500 4096 Sep 09 16:02 lvs
-rw-r--r-- 1 500 500 2764 Sep 09 17:35 zabbix_sender.py
-rw-r--r-- 1 0 0 0 Sep 09 17:32 zhujiangtao
drwxr-xr-x 2 0 0 4096 Sep 09 17:32 zhuzhu

get,put指令針對的是文件,
若要針對目錄,可用到另一重要的指令。mirror

Copyright © Linux教程網 All Rights Reserved