Rsync command details
Rsync Parameters
-A archive mode, equivalent to-rlptgoD
-D is equivalent to -- devices -- specials
-G: Keep the group before and after file transfer consistent
-L reserved Symbolic Links
-O ensure the owner consistency before and after File Transfer
-P: ensure the same permissions before and after file transfer.
-R recursive Transmission
-T keep the modification time before and after file transmission consistent
-U if the modification time of the target file is later than the modification time of the source file, the target file will not be overwritten.
-V shows the File Transfer Process
-W: transfer all files
-Z transfers files in Compressed Mode
-- Delete: delete files in the target directory but not in the source directory.
-- Existing only synchronizes the files in the source and target files
-- Password-file = FILE: get the password from the FILE.
-- Progress shows the transmission progress of each file
-- Max-size = SIZE: do not transmit files larger than SIZE
-- Min-size = SIZE: do not transmit files smaller than SIZE
Common parameter combinations:-avz
Example
Copy all the files in the/wwwroot directory of the current host to the/wwwroot directory of 192.168.1.1:
Rsync-avz/wwwroot root@192.168.1.1:/wwwroot
Copy all the files in the/wwwroot directory of the current host to the/wwwroot directory of 192.168.1.1, but exclude the log directory:
Rsync-avzP -- exclude = "log"/wwwroot root@192.168.1.1:/wwwroot
Suppose we need to copy the/root/file of the remote host (192.168.1.1, SSH port number is 222) to the/tmp directory of the current host, then we can do this:
Rsync-avz-e 'ssh-p 222 'root@192.168.1.1:/root/file/tmp/
RSync for file backup Synchronization
Monitor host files and directories using inotifywait
Using inotify + rsync for Linux File batch update
Inotify-tools + rsync real-time file synchronization installation and configuration
Complete rsync synchronization Configuration
Remote synchronization of Rsync in CentOS 6.5
Differential file comparison and extraction in Linux folders-the use of rsync
Rsync details: click here
Rsync: click here
This article permanently updates the link address: