基礎命令學習目錄php
scp是secure copy的簡寫,用於在Linux下進行遠程拷貝文件的命令, scp傳輸是加密的,可能會稍微影響一下速度。另外,scp還很是不佔資源,不會提升多少系統負荷,在這一點上,rsync就遠遠不及它了。雖然 rsync比scp會快一點,但當小文件衆多的狀況下,rsync會致使硬盤I/O很是高,而scp基本不影響系統正常使用html
1
2
3
4
5
6
7
8
9
10
|
usage:
scp
[-1246BCpqrv] [-c cipher] [-F ssh_config] [-i identity_file]
[-l limit] [-o ssh_option] [-P port] [-S program]
[[user@]host1:]file1 ... [[user@]host2:]file2
-q: quiet
-r: recuersive
-p: properity
-
v
: verbose
-i: identity_file 【從指定文件中讀取傳輸時使用的密鑰文件,此參數直接傳遞給
ssh
】
-P: port
|
scp命令的實際應用概述: shell
從本地服務器複製到遠程服務器:服務器
(1) 複製文件: ssh
命令格式:ide
scp local_file remote_username@remote_ip:remote_folder 學習
或者ui
scp local_file remote_username@remote_ip:remote_file 加密
或者spa
scp local_file remote_ip:remote_folder
或者
scp local_file remote_ip:remote_file
第1,2個指定了用戶名,命令執行後須要輸入用戶密碼,第1個僅指定了遠程的目錄,文件名字不變,第2個指定了文件名
第3,4個沒有指定用戶名,命令執行後須要輸入用戶名和密碼,第3個僅指定了遠程的目錄,文件名字不變,第4個指定了文件名
(2) 複製目錄:
命令格式:
scp -r local_folder remote_username@remote_ip:remote_folder
或者
scp -r local_folder remote_ip:remote_folder
第1個指定了用戶名,命令執行後須要輸入用戶密碼;
第2個沒有指定用戶名,命令執行後須要輸入用戶名和密碼