The SCP is a shorthand for secure copy, which is used to copy files from a remote machine under Linux.
Characteristics:
The transmission is encrypted and slightly affects the speed. Compared with rsync, it has an advantage over resource occupancy.
Usage
SCP [parameter] [original path] [Target path]
Parameters
-C Compression
-P retains the original file's modification time, access time, and access rights.
-Q does not display the transfer progress bar.
-R recursively replicates the entire directory.
-V verbose displays the output. SCP and SSH (1) will display debugging information for the entire process. This information is used to debug connections, authentication, and configuration issues.
-L Limit
-P Specify the transport port
Example:
Copy files locally to the remote machine:
Command format:
SCP Local_file [Email Protected]_ip:remote_folder
Or
SCP Local_file [Email protected]_ip:remote_file
Or
SCP Local_file Remote_ip:remote_folder
Or
SCP Local_file Remote_ip:remote_file
Copy directories locally to the remote machine:
Command format:
Scp-r Local_folder [Email protected]_ip:remote_folder
Or
Scp-r Local_folder Remote_ip:remote_folder
To copy a directory from a remote machine to a local server:
SCP [Email protected]:/opt/soft/nginx-0.5.38.tar.gz/opt/soft/
[Email protected]:/run/network$SCP[Email protected]192.168.2.100:/home/jerry/download/jdk-8u65-linux-x64.Tar. GZ ~The authenticity of host'192.168.2.100 (192.168.2.100)'Can't be established.ECDSA key fingerprint is da:b7:c3:2a:ea:a2: the: 4c:c3:c1: the: Ca:0e:c2:ea: the. Is you sure want to continue connecting (yes/no)?Yeswarning:permanently added'192.168.2.100'(ECDSA) to the list of known hosts. [Email protected]192.168.2.100's Password:SCP:/home/jerry/download/jdk-8u65-linux-x64.Tar. Gz:no suchfileor Directory[email protected]:/run/network$SCP[Email protected]192.168.2.100:/home/jerry/downloads/jdk-8u65-linux-x64.Tar. GZ ~[email protected]192.168.2.100's Password:Jdk-8u65-linux-x64.Tar. gz -% 173MB +.6mb/sxx: ,[email protected]:/run/network$
Reference:
One Linux command per day: SCP command
Linux->> SCP command to copy files/folders on the peer machine