Linux explains how to copy files from one machine to another.
1. Function Description
Scp Is security copy, which is used to copy files or directories from one Linux system to another. Scp uses the SSH protocol to ensure data transmission security. The format is as follows:
Scp remote username @ IP Address: absolute path of the file local Linux System Path
Scp local Linux system file path remote user name @ IP Address: absolute path name of the remote system file
Scp uses the first format to copy a file or directory on a remote Linux system to a local Linux system, the second method is to copy a local file or directory to a path in a remote Linux system.
2. Example
(1) In the Linux system with the IP address "192.168.60.133", we plan to copy the/home/ixdba/etc.tar.gz file in the system to the IP address "192.168.60 ".
168 "remote Linux system under the/tmp directory of the root user:
Scp/home/ixdba/etc.tar.gz root@192.168.60.168:/tmp
After the command is entered, enter the root password of the "192.168.60.168" server and then copy data remotely.
If we are on the "192.168.60.168" server, you can also use the following command to transmit data:
Scp root@192.168.60.133:/home/ixdba/etc.tar.gz/tmp
After the command is entered, enter the root password of the "192.168.60.htm" server, and then start copying data remotely. For example: scp./id_rsa.pubjing.wei@10.28.8.20:/home/jing. wei go to a server and copy id_rsa.pub in the current directory to another server.
(2) Copy all the files and sub-directories in the local/etc directory to the/opt directory under the root user of the remote Linux system whose IP address is 192.168.60.135:
Scp-r/etc root@192.168.60.135:/opt
The option "r" here is the same as the option "r" of the cp command.