1)终端连接
1 2 3 4 5 6 7 8 9 10 |
#文件传输命令 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 |
2)服务器之间连接
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
#连接 [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的时候,前面的是本地服务器,后面的是远程服务器 |
3)文件传输工具
1 2 3 4 |
#图形化工具 1.xftp 2.filezilla 3.flashfxp |
4)命令对比
1 2 3 4 5 6 7 8 9 |
1.rz/sz: 1.不能上传4G以上的文件 2.不能断点续传 3.不能上传文件夹 2.sftp: 1.能上传大于4G的文件 2.能断点续传 3.可以上传文件 |