English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية
The Linux SCP command is used for copying files and directories between Linux systems.
SCP is an abbreviation for secure copy, SCP is a command for secure remote file copying based on SSH login under the Linux system.
SCP is encrypted,RCP It is not encrypted, SCP is the enhanced version of RCP.
scp [-1246BCpqrv] [-c cipher] [-F ssh_config] [-i identity_file] [-l limit] [-o ssh_option] [-P port] [-S program] [[user@]host1:]file1 [...] [[user@]host2:]file2
Simplified notation:
scp [optional parameters] file_source file_target
Parameter description:
Command format:
scp local_file remote_username@remote_ip:remote_folder or scp local_file remote_username@remote_ip:remote_file or scp local_file remote_ip:remote_folder or scp local_file remote_ip:remote_file
Application Example:
scp /home/space/music/1.mp3 [email protected]:/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.oldtoolbag.com:/home/root/others/music scp /home/space/music/1.mp3 www.oldtoolbag.com:/home/root/others/music/001.mp3
Directory copy command format:
scp -r local_folder remote_username@remote_ip:remote_folder or scp -r local_folder remote_ip:remote_folder
Application Example:
scp -r /home/space/music/ [email protected]:/home/root/others/ scp -r /home/space/music/ www.oldtoolbag.com:/home/root/others/
The above command copies the local music directory to the remote others directory.
To copy from remote to local, just change the order of the parameters in the command that copies from local to remote, as follows2Changing the order of the parameters, as shown in the following example
Application Example:
scp [email protected]:/home/root/others/music /home/space/music/1.mp3 scp -r www.oldtoolbag.com:/home/root/others/ /home/space/music/
1.If the remote server firewall has set a specific port for the scp command, we need to use -Use the P parameter to set the command port, the command format is as follows:
#scp Command Port Usage 4588 scp -P 4588 [email protected]:/usr/local/sin.sh /home/administrator
2Ensure that the user has read permissions for the corresponding files on the remote server when using the scp command, otherwise the scp command will not work.