Linux基础命令---get获取ftp文件教程
get
使用lftp登录ftp服务器之后,可以使用get指令从服务器获取文件。
1、语法
get [-E] [-a] [-c] [-O base] rfile [-o lfile]
2、选项列表
选项
说明
-o
指定输出文件的名字,不指定则使用原来的名字
-c
如果失败,持续获取
-E
获取之后,删除源文件
-a
使用ascii模式
-O
指定输出文件存放的目录
3、实例
1)获取文件,指定存储的名字
[root@localhost weijie]# <strong>lftp 192.168.1.8 //</strong>
`登录<strong>ftp</strong>
服务器`
lftp 192.168.1.8:~> <strong>ls</strong>
drwxr-xr-x 2 0 0 4096 Aug 14 06:38 pub
lftp 192.168.1.8:/> <strong>cd pub/ //</strong>
`切换目录`
lftp 192.168.1.8:/pub> <strong>ls //</strong>
`查看文件`
-rwxrwxrwx 1 0 0 2375494044 Aug 14 06:38 1.zip
-rw-r--r-- 1 0 0 0 Aug 14 03:38 test.c
lftp 192.168.1.8:/pub><strong> get test.c -o testtt.c //</strong>
`获取文件,存储名字为`<strong>testtt.c</strong>
lftp 192.168.1.8:/pub> <strong>quit //</strong>
`退出`
[root@localhost weijie]# <strong>ls //</strong>
`查看内容,已经获取到文件。文件存储在当前目录`
1 11.c 1.zip 2.c.bz2 4.c 6.c~ rec000012.c.bz2 testtt.c
1. 1.c 2.c 3.c 5.c col res.zip
2)获取文件,指定存储位置
[root@localhost weijie]#<strong> lftp 192.168.1.8 //</strong>
`登录服务器`
lftp 192.168.1.8:~> <strong>cd pub/ //</strong>
`切换目录`
lftp 192.168.1.8:/pub><strong> get -O / test.c //</strong>
`获取文件,指定存储位置到根目录`
lftp 192.168.1.8:/pub><strong>quit //</strong>
`退出`
[root@localhost weijie]# <strong>ls / //</strong>
`查看更目录,已经得到文件`
bak dev lib misc opt sbin sys usr wj
bin etc lost+found mnt proc selinux <strong> test.c </strong> var
boot home media net root srv tmp weijie
做了一个Linux学习的平台,目前出来一个雏形,各位可以参考使用
链接:https://pan.baidu.com/s/1GOLVU2CbpBNGtunztVpaCQ 密码:n7bk