一、終端連接
#文件傳輸命令
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)可以上傳文件夾