How to copy files between two Linux computers

  

We sometimes need to copy files between different computers, so how to quickly copy files between two computers has become a concern of many users. Today, Xiaobian teaches you how to copy files between Linux computers. Users who need it can take a look.

Solution:

Method One: Suppose now we have two servers:

(A) * .111

(B) *.222

Now we need to copy all the files in the /temp/directory on the *.111 server to the /test/directory of the *.222 server;

Then we will execute the command line. Mode:

Type the following command:

scp root@*.111:/temp//test/

#Note to enter the remote *.111 server as root, *.111 server /temp/and the following files are copied to the *.222 local server's /test/directory;

Method 2: The easiest way to copy files between two servers in Linux

The transfer file in linux has the scp command to be implemented quickly and easily. Let's take a look at the usage of the scp command and how to implement the server transfer file.

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 cumbersome and will not be described here. The easiest way is scp, which can be understood as the cp command under the ssh pipeline.

Copy the current file to the remote server:

scp /home/a.txt [email protected]:/home/root

Then you will be prompted to enter 192.168 The root password of .0.8 is then copied and transferred.

Copy the remote host to the current host:

scp [email protected]:/home/b.txt

Copy folder:

scp -r [email protected]:/home//root/home2

Command scp Introduction

scp Local Username@IP Address: File Name 1 Remote User Name @IP Address: File Name 2

[Local Username@IP Address:] You can enter the password corresponding to the remote username. You may need to enter the password corresponding to the remote username.

Several parameters that may be useful:

- v is the same as -v in most Linux commands. It is used to display progress. It can be used to view connection, authentication, or configuration errors.

-C Enable compression options.

-P Select port. Note that -p is already used by rcp.

-4 Force IPV4 address.

-6 Forcibly use IPV6 address.

Copy single file command:

scp file username@ip:filepath

Description:

file: The name of the file to be copied

username: the username of the remote login,

ip: remote server ip

Filepath: remote file path

The copy folder command is as follows (plus one -r parameter):

scp -r file username@ip:filepath

If you If you have two Linux, then this little trick can make it easy for you to copy files between two computers, so these users will quickly collect these two methods.

Copyright © Windows knowledge All Rights Reserved