CentOS: 172.16.100.60 (本地主機IP)
CentOS: 172.16.100.61 (遠程主機IP)
實戰任務:Linux系統之間文件轉輸
1、SCP複製本地文件到遠程主機
[root@Linux sheel]# scp /home/sheel/file1 [email protected]:/tmp
[email protected]'s password:
file1 100% 94 40.3KB/s 00:00
2、SCP複製本地目錄到遠程主機
[root@Linux sheel]# scp -r /home/sheel [email protected]:/tmp
[email protected]'s password:
file1 100% 94 53.7KB/s 00:00
file2 100% 94 120.7KB/s 00:00
3、SCP從遠程主機複製文件到本地目錄
[root@Linux sheel]# scp [email protected]:/tmp/test /home/sheel
[email protected]'s password:
test 100% 46 4.7KB/s 00:00
4、SCP從遠程主機複製目錄到本地目錄
[root@Linux sheel]# scp -r [email protected]:/tmp /home/sheel
[email protected]'s password:
heartalive.lock 100% 0 0.0KB/s 00:00
ixdbafile1 100% 94 2.5KB/s 00:00
ixdbafile1 100% 94 27.3KB/s 00:00
ixdbafile12 100% 94 125.5KB/s 00:00
test 100% 46 69.4KB/s 00:00
實戰小結:
“-r”參數是複製目錄;
不帶“-r”參數是指複製文件;
scp 遠程用戶名@ip地址:文化的絕對路徑 本地Linux系統路徑;
本地Linux系統文件路徑 遠程用戶名@ip地址:遠程系統文件絕對路徑名。