Rsync command introduction and implementation

Source: Internet
Author: User
Tags rsync rsync usage

Rsync is easy to use and can enhance operation security if used properly. In addition, it can also be used as a security detection tool, without the support of any other software, you can complete the Integrity audit of the file system.


Rsync uses 1. resumable data transfer. You can resume data transfer when you use rsync-avzP xxx remotehost:/xxx, see the "Shell" section in "How to Apply rsync:
If the transmission is interrupted during the file copy process, rsync deletes some copied files from the target machine by default. If you do not need to re-copy all files during the next copy, you can use the-partial option to prevent rsync from deleting the copied part during the transmission interruption. If you want to use both the-partial and-progress options, you can use the-P option, which is a more convenient option provided by rsync and can replace the two.
However, you must note that the-z parameter cannot be included when you need to resume the data transfer; otherwise, the Data fails.


Rsync 2. When cwrsync is used in windows, you can write the cwrsync directory to the system environment variable, so that you do not need to run the rsync command in the installation directory of cwrsync every time.


Rsync usage 3. When you need to connect to files in windows, the drive letter cannot be directly similar to c: \; d: \, and so on. Conversion is required:
 

 
 
  1. Example : C:\WORK\* --> /cygdrive/c/work/*  
  2. Example 1 - rsync recursively to a unix server with an openssh server :  
  3. rsync -r /cygdrive/c/work/ remotehost:/home/user/work/  
  4. Example 2 - Local rsync recursively   
  5. rsync -r /cygdrive/c/work/ /cygdrive/d/work/doc/  
  6. Example 3 - rsync to an rsync server recursively :  
  7. (Double colons?? YES!!)  
  8. rsync -r /cygdrive/c/doc/ remotehost::module/doc  

Rsync is used. 4. When you need to transfer files from a linux system to a windows system, you can perform reverse transfer. The specific operation is as follows:
Rsync-avzP remotehost:/home/user/work/xx. xx/cygdrive/c/work/


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.