How to use: SCP command
SCP can copy files between 2 Linux hosts;
Command basic format:
SCP [Optional parameters] File_source File_target
======
Copy from local to remote
-
Copy file:
* command format:
SCP local_file [Email protected]_ip:remote_folder
or
SCP local_file [EMAIL&N Bsp;protected]_ip:remote_file
or
SCP local_file remote_ip:remote_folder
or
SCP local_file remote_ip:re Mote_file
1th, 2 Specify the user name, the command executes after the password is entered, the 1th only specifies the remote directory, the file name is not changed, 2nd specifies the file name, 3rd, 4 does not specify a user name, the command executes after the user name is entered and password, the 3rd only specifies the remote directory, the file name is not changed, and the 4th specifies the file name; * Example: Scp/home/space/music/1.mp3 [Email protected]:/home/root/others/musi C 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
To copy a directory:
* Command format:
Scp-r Local_folder [Email protected]_ip:remote_folder
Or
Scp-r Local_folder Remote_ip:remote_folder
第1个指定了用户名,命令执行后需要再输入密码; 第2个没有指定用户名,命令执行后需要输入用户名和密码; * 例子: scp -r /home/space/music/ [email protected]:/home/root/others/ scp -r /home/space/music/ www.cumt.edu.cn:/home/root/others/
======
Copy from remote to local
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.
Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.
How to use SCP commands