Two ways to transfer files between Linux servers

Source: Internet
Author: User
Tags rsync secure copy

Mode one: SCP


"Advantages" simple and convenient, safe and reliable; Support speed limit parameters

"Disadvantage" does not support exclude directories

Usage

The SCP is secure copy, which is used for remote file copying. The data transfer uses SSH and uses the same authentication method as SSH, providing the same security guarantee.


SCP [parameters] < source address (user name @ip address or host name) >:< file path > < destination address (user name @IP address or hostname) >:< file path >


Example:

scp/home/work/source.txt [email protected]:/home/work/#把本地的source. txt files are copied to the/home/work directory on the 192.168.0.10 machine

SCP [email protected]:/home/work/source.txt/home/work/#把192. source.txt files on 168.0.10 machine are copied to the local/home/work directory

SCP [email protected]:/home/work/source.txt [Email protected]:/home/work/# Copy the Source.txt file on the 192.168.0.10 machine to the/home/work directory of the 192.168.0.11 machine.

Scp-r/home/work/sourcedir [email protected]:/home/work/#拷贝文件夹, plus-r parameter

Scp-r/home/work/sourcedir [Email protected]:/home/work/#使用主机名

Scp-r-v/home/work/sourcedir [email protected]:/home/work/#显示详情, plus-v parameter



Mode two: rsync


"Advantages" powerful, operation-like SCP, support to exclude directories, support speed limit parameters, also support local replication.

"Disadvantage" no

Usage

Rsync is a data-mirroring Backup tool under Unix-like systems, and--remote sync can be seen from the name of the software. It operates in the same way as the SCP and is much more powerful than the SCP. When using a double colon to split the hostname and file path, the rsync server is used, which is not described here.

Command format:

rsync [parameters] < source address (user name @ip address or host name) >:< file path > < destination address (user name @IP address or hostname) >:< file path >


Example:

rsync/home/work/source.txt [email protected]:/home/work/#把本地的source. txt files are copied to the/home/work directory on the 192.168.0.10 machine

rsync [Email protected]:/home/work/source.txt/home/work/#把192. source.txt files on the 168.0.10 machine are copied to the local/home/work directory

rsync [email protected]:/home/work/source.txt [Email protected]:/home/work/# Copy the Source.txt file on the 192.168.0.10 machine to the/home/work directory of the 192.168.0.11 machine.

Rsync-r/home/work/sourcedir [email protected]:/home/work/#拷贝文件夹, plus-r parameter

Rsync-r/home/work/sourcedir [Email protected]:/home/work/#使用主机名

Rsync-r-v/home/work/sourcedir [email protected]:/home/work/#显示详情, plus-v parameter


Two ways to transfer files between Linux servers

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.