linux 的 scp 命令 可以 在 linux 之間複製 檔案 和 目錄;
==================
scp 命令
==================
scp 可以在 2個 linux 主機間複製檔案;
命令基本格式:
scp [選擇性參數] file_source file_target
scp命令:兩個伺服器之間檔案複製
| 代碼如下 |
複製代碼 |
scp /home/space/1.html root@IP地址:/home/root/others/ #這裡複製本地/home/space/1.html到遠程地址的/home/root/others中,在斷行符號之後系統會提示 [root@localhost data]# scp -r /data/rsynctest/ root@192.168.42.128:/data/rsync The authenticity of host '192.168.42.128 (192.168.42.128)' can't be established. RSA key fingerprint is 6d:cd:c9:6c:8d:40:aa:1c:0d:db:62:9f:63:4c:3c:b1. Are you sure you want to continue connecting (yes/no)? yes #這裡直接輸入yes,然後下來輸入遠端使用者的密碼即可複製 [root@localhost data]# scp -r /data/rsynctest/ root@192.168.42.128:/data/rsync The authenticity of host '192.168.42.128 (192.168.42.128)' can't be established. RSA key fingerprint is 6d:cd:c9:8c:9d:40:aa:1c:0d:db:62:9f:63:4c:3c:b1. Are you sure you want to continue connecting (yes/no)? yes 1 100% 15 0.0KB/s 00:00 1.jpg 100% 0 0.0KB/s 00:00 test.html 100% 10 0.0KB/s 00:00 |
從 本地 複製到 遠程
======
* 複製檔案:
* 命令格式:
| 代碼如下 |
複製代碼 |
scp local_file remote_username@remote_ip:remote_folder 或者 scp local_file remote_username@remote_ip:remote_file 或者 scp local_file remote_ip:remote_folder 或者 scp local_file remote_ip:remote_file
|
第1,2個指定了使用者名稱,命令執行後需要再輸入密碼,第1個僅指定了遠端目錄,檔案名稱字不變,第2個指定了檔案名稱;