scp命令 – 遠程拷貝文件
scp 拷貝本地文件filename 到遠程機器 192.168.188.188 伺服器的/data/tmp目錄下
scp -P 61204 -l 40000 filename username@192.168.188.188:/data/tmp/-P port
Specifies the port to connect to on the remote host. Note that this option is written with a capital 『P』, because -p is already reserved for preserving the times and modes of the file in rcp(1).#-P 指定遠程伺服器ssh服務的埠 如:ssh埠為61204-l limit Limits the used bandwidth, specified in Kbit/s.-l 指定拷貝的速度限制 單位是ct/s 如:-l 40000 表示40000Kbit/s=40000/8KB=5MB的速度
註:scp不支持斷點續傳
rsync + ssh 斷點續傳
#rsync同步本地文件 filename 到遠程機器 192.168.188.188 伺服器的/data/tmp目錄下
rsync -avzP -e 'ssh -p 61204' --bwlimit=5000 filename username@10.20.90.101:/data/tmp/ >> scp_to_101.log-a:以archive模式操作,複製目錄、符號連接,等價於 -rlptgoD 。-v:詳細提示-z:壓縮-P:是綜合了–partial –progress兩個參數–partial
如果在拷貝文件的過程中,傳輸被中斷,rsync的默認操作是撤消前操作,即從目標機上刪除已拷貝的部分文件。如果想在下次拷貝時續傳文件,不需要重新拷貝所有文件的話,可以使用-partial選項阻止rsync在傳輸中斷時刪除已拷貝的部分–progress 顯示進度條-e:參數的作用是可以使用戶自由選擇欲使用的shell程序來連接遠端伺服器
ssh -p 61204指定ssh的埠(非默認22)61204–bwlimit: –bwlimit=5000 限制帶寬為5000k Bytes/s =5MB
上例:使用rsync傳輸本地文件filename到192.168.188.188的/data/tmp目錄下 使用壓縮歸檔傳輸、限速5MB、支持斷點續傳 使用ssh協議
原創文章,作者:投稿專員,如若轉載,請註明出處:https://www.506064.com/zh-tw/n/224874.html
微信掃一掃
支付寶掃一掃