Method One
Suppose we currently have two servers:
(A) *.111
(B) *.222
Now we are going to copy all the files in the/temp/directory on the *.111 server to the/test/directory of the *.222 server;
Let's do the command line mode:
Type the following directive:
SCP root@*.111:/temp//test/
#注解 as root into the remote *.111 server, the *.111 server/temp/and the following files are copied to the *.222 of the local server/test/directory;
method Two: The easiest way to transfer files between Linux two servers
Linux transfer files with SCP commands can be quickly and easily implemented, let's look at the SCP command usage and how to implement server transfer files.
There are usually 4 ways to copy files between different Linux
1.ftp
2.samba Service
3.sftp
4.scp
The above three methods, are more cumbersome, here do not repeat. The simplest approach is the SCP, which can be understood as the CP command under the SSH pipeline.
Copy the current file to a remote server:
Scp/home/a.txt Root@192.168.0.8:/home/root
You will then be prompted to enter the root password for 192.168.0.8, and then the replication transfer begins.
Copy the remote host to the current host:
SCP Root@192.168.0.8:/home/b.txt
To copy a folder:
Scp-r root@192.168.0.8:/home//root/home2
Command SCP Introduction
SCP Local username @ip address: filename 1 remote username @ip address: filename 2
[Local username @ip address:] You may need to enter the password for the remote user name without entering it.
Several parameters that may be useful:
-V, as in most Linux commands, is used to show progress. Can be used to view connections, authentication, or configuration errors.
-C enables compression options.
-P Select the port. Note-P has been used by RCP.
-4 forcibly use IPV4 address.
-6 forcibly use IPV6 address.
To copy a single file command:
SCP file Username@ip:filepath
Description
File: filename to copy
Username: User name for remote login,
IP: Remote server IP
FilePath: Remote file path
Copy folder commands as follows (plus a-r argument):
Scp-r file Username@ip:filepath