One Linux command per day (a) SCP command

Source: Internet
Author: User
Tags scp command secure copy

The SCP (secure copy) is used for remote file copies.

(1) Usage:

usage: SCP [parameter] [source file] [target file]

(2) Function:

function: scp copies files between hosts, he uses SSH (1) As data transfer, and uses the same authentication and security. File replication between two remotely-enabled servers is allowed.

(3) Option parameters:

1)-R recursively copy the entire folder

2) -P retains the last modified time of the file, last access time and permission mode;

(4) Example:

1) [Email protected]:/home/sunjimeng/desktop # rcp [email protected]:/home/sunmeng/rcptext./copy remote files to local

[Email protected]:/home/sunjimeng/Desktop # ll total dosage8drwxr-xr-x2Sunjimeng Sunjimeng4096June -  ,: the./drwxr-xr-x -Sunjimeng Sunjimeng4096June in  ,: -.. /[email protected]:/home/sunjimeng/Desktop # rcp [email protected]:/home/sunmeng/rcptext./[email protected]:/home/sunjimeng/Desktop # ll total dosage8drwxr-xr-x2Sunjimeng Sunjimeng4096June -  ,: About./drwxr-xr-x -Sunjimeng Sunjimeng4096June in  ,: -.. /-rw-r--r--1Root root0June -  ,: AboutRcptext

2) [Email protected]:/home/sunjimeng/Desktop # rcp-r [email protected]:/home/sunmeng/documents./Copy remote file to local

[Email protected]:/home/sunjimeng/Desktop # rcp [email protected]:/home/sunmeng/documents./rcp:/home/sunmeng/Documents:not a plain file[email protected]:/home/sunjimeng/Desktop # rcp-r [email protected]:/home/sunmeng/documents./[email protected]:/home/sunjimeng/Desktop # ll total dosage Adrwxr-xr-x3Sunjimeng Sunjimeng4096June -  ,: -./drwxr-xr-x -Sunjimeng Sunjimeng4096June in  ,: -.. /drwxr-xr-x2Root root4096June -  ,: -documents/-rw-r--r--1Root root0June -  ,: AboutRcptext

3) Copy remote files to local

 CentOS:
[[email protected] documents]# ll total dosage8-rw-r--r--.1Root root -June - -: +Text1.txt-rw-r--r--.1Root root $June - -: +text2.txtUnbuntu:
[Email protected]:/home/sunjimeng/Desktop # ll total dosage8drwxr-xr-x2Sunjimeng Sunjimeng4096June - the:xx./drwxr-xr-x -Sunjimeng Sunjimeng4096June in ,: -.. /[email protected]:/home/sunjimeng/Desktop # Touch Unbuntu.txt[email protected]:/home/sunjimeng/Desktop # rcp./unbuntu.txt [Email protected]:/home/sunmeng/documents/ CentOS:
[[email protected] documents]# ll total dosage8-rw-r--r--.1Root root -June - -: +Text1.txt-rw-r--r--.1Root root $June - -: +Text2.txt-rw-r--r--1Sunmeng Sunmeng0June in -: toUnbuntu.txt

4) [[email protected] documents]# rcp-p text2.txt [email protected]:/home/sunjimeng/Desktop to preserve the original file properties when copying files

 CentOS:[[email protected] documents]# ll total dosage8-rw-r--r--.1Root root -June -  -: +Text1.txt-rw-r--r--.1Root root $June -  -: +text2.txt[[email protected] documents]# rcp text1.txt [email protected]:/home/sunjimeng/desktop [[email protected] documents]# rcp-P text2.txt [email protected]:/home/sunjimeng/Desktop unbuntu:[email protected]:/home/sunjimeng/Desktop # ll total dosage -drwxr-xr-x2Sunjimeng Sunjimeng4096June -  the: -./drwxr-xr-x -Sunjimeng Sunjimeng4096June -  the: -.. /-rw-r--r--1Root root -  June  the: +Text1.txt-rw-r--r--1Root root $  June  A: +Text2.txt

(5) Other:

The difference between RCP and SCP:

rcp copies files or directories remotely through rsh, and the SCP copies files or directories remotely via SSH.

RCP is an insecure way to transfer files, and SCP is more secure, but it is possible for the SCP command to be executed with the user entering a password and passwords.

Commands and tools for data transfer between different servers under Linux: Rcp,scp,rsync,ftp,sftp,lftp,wget,curl. (http://blog.csdn.net/emili/article/details/6858818)

One Linux command per day (a) SCP command

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

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.