SCP is the most powerful file transfer command in Linux, enabling easy file transfer operations from local to remote and remote to local. The following is a brief explanation of the operation of the SCP command, for some useful reference:
The first is the local to remote operation: The format of the operation is as follows
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
1th, 2 Specify the user name, command execution after the need to enter the password, the 1th only specifies the remote directory, the file name is unchanged, 2nd specified the file name;
3rd, 4 does not specify a user name, command execution after the need to enter a user name and password, the 3rd only specifies the remote directory, the file name is unchanged, 4th specified the file name;
Example
Scp/home/space/music/1.mp3 [email protected]du. cn:/home/root/others/music
Scp/home/space/music/1.mp3 [Email Protected]:/home/root/others/music/001.mp3
Scp/home/space/music/1.mp3 Www.cumt.edu.cn:/home/root/others/music
Scp/home/space/music/1.mp3 Www.cumt.edu.cn:/home/root/others/music/001.mp3
* Copy directory:
* Command format:
Scp-r Local_folder [Email protected]_ip:remote_folder
Or
Scp-r Local_folder Remote_ip:remote_folder
The 1th one specifies the user name, the command executes after the need to enter the password;
The 2nd does not specify a user name, the command will need to enter the user name and password after execution;
Example
Scp-r/home/space/music/[Email protected]:/home/root/others/
Scp-r/home/space/music/www.cumt.edu.cn:/home/root/others/
The above command copies the local music directory to the remote others directory, which is remotely available after replication. /others/music
2, is the implementation of remote-to-local file transfer operations:
From remote copy to local, as long as the copy from the local to the remote command of the following 2 parameter Exchange order;
For example:
SCP [Email Protected]:/home/root/others/music/home/space/music/1.mp3
Scp-r www.cumt.edu.cn:/home/root/others//home/space/music/
The simplest applications are as follows:
SCP Local username @IP address: File name 1 remote user name @IP address: file name 2
[Local User name @IP address:] Can not be entered, you may need to enter the password for the remote user name.
Several parameters that may be useful:
-V is the same as-V in most Linux commands to show progress. Can be used to view connections, certifications, or configuration errors.
-C Enable compression option.
-P Select the port. Note-P has been used by RCP .
-4 forcibly use the IPV4 address.
-6 forcibly use the IPV6 address.
The use of Linux SCP commands should be able to satisfy everyone's use of the Linux files and directory replication
SCP remote file copy of Linux command