Two ways to copy files between two Linux servers

Source: Internet
Author: User
Tags scp file scp command

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.