The SCP is the command for remote file copies under the Linux system based on SSH login.
There are two kinds, one is from local to remote, the other is from remote to local.
1. From local to remote
File copy:
The code is as follows |
Copy Code |
SCP Local_file Remote_user@remote_ip:remote_file |
Catalog copy:
The code is as follows |
Copy Code |
Scp-r Local_folder Remote_user@remote_ip:remote_folder |
2. From remote to local
File copy:
The code is as follows |
Copy Code |
SCP Remote_user@remote_ip:remote_file Local_file |
Example:
The code is as follows |
Copy Code |
Scp/home/space/music/1.mp3 Root@www.cumt.edu.cn:/home/root/others/music Scp/home/space/music/1.mp3 Root@www.cumt.edu.cn:/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 |
Catalog copy:
The code is as follows |
Copy Code |
Scp-r Remote_user@remote_ip:remote_folder Local_folder |
Example:
The code is as follows |
Copy Code |
Scp-r/home/space/music/root@www.cumt.edu.cn:/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/Directory