注意scp只能在linux操做系統平臺上,要想在linux與window平臺上傳文件或者目錄,下載一個winscp軟件或者下載一個sshsecure shell軟件安裝在window上便可,很是方便,直接拖拉就行。linux
1.上傳本機文件到遠程服務器shell
scp file_path 用戶名@remote_ip:remote_path/服務器
2.上傳本機目錄到遠程服務器ssh
scp -r file_path 用戶名@remote_ip:remote_path/操作系統
3.拷貝遠程服務器文件到本機code
scp 用戶名@remote_ip:remote_path/file_name local_path/ip
4.拷貝遠程服務器目錄到本機rem
scp -r 用戶名@remote_ip:remote_path/folder_name local_path/軟件
5.拷貝遠端A服務器文件到另一臺B服務器file
scp A機器文件路徑(加文件名) 用戶名@B機器ip:B機器目錄保存路徑
6.拷貝遠端A服務器目錄及其子目錄到另一臺B服務器
scp -r A機器目錄路徑 用戶名@B機器ip:B機器目錄保存路徑
出現not a regular file 錯誤 是由於複製的不是一個文件而是一個文件夾,須要加-r 參數
scp -r /home/files root@172.16.252.32:/home/files