第四章 SFTP命令使用

一、终端连接

#文件传输命令
sftp:/root> 

#下载文件
sftp:/root> get hostname_ip.sh
Fetching /root/hostname_ip.sh to hostname_ip.sh
sftp: received 497 ؖ½ؠin 0.01 seconds

#上传文件
sftp:/root> put

二、服务器之间连接

#连接
[root@web01 ~]# sftp root@172.16.1.31
root@172.16.1.31's password: 
Connected to 172.16.1.31.

#操作远程连接过去的机器
sftp> pwd
Remote working directory: /root
sftp> ls -l
-rw-------    1 root     root         1429 Jul  6 02:17 anaconda-ks.cfg
-rw-r--r--    1 root     root          497 Aug  5 20:15 hostname_ip.sh
-rw-r--r--    1 root     root       727290 Aug 15 01:15 sersync2.5.4_64bit_binary_stable_final.tar.gz

#如果想操作本机,则在命令前加一个 l
sftp> lls -l
total 8
-rw-r--r--  1 root root    0 Aug 18 00:25 1.txt
-rw-------. 1 root root 1429 Jul  6 02:17 anaconda-ks.cfg
-rw-r--r--. 1 root root  497 Aug  5 20:15 hostname_ip.sh

#拉取命令
sftp> get 1.txt ./
#当使用拉取命令的时候,前面的是远程服务器,后面的是本地服务器

#推送命令
sftp> put 1.txt ./
#当使用put的时候,前面的是本地服务器,后面的是远程服务器

三、文本传输工具

#图形化工具
1)xftp
2)filezilla
3)flashfxp
4)mobaxterm

4.命令对比
#rz/sz:
	1)不能上传4G以上的文件
	2)不能断点续传
	3)不能上传文件夹

#sftp:
	1)能上传大于4G的文件
	2)能断点续传
	3)可以上传文件夹
posted @ 2022-02-08 14:23  年少纵马且长歌  阅读(823)  评论(0编辑  收藏  举报