linux下scp命令使用方法

來源:互聯網
上載者:User

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個指定了檔案名稱;

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.