Detailed parameters
-a archiving mode, equivalent to-rlptgod- D is equivalent to--devices--specials-G Maintain group consistency before and after file transfer-L Keep Symbolic links-O Keep the owner consistent before and after file transfer-p maintain consistent permissions before and after file transfer-R Recursive Transfer-T maintain consistent modification time before and after file transfer-u do not overwrite the target file if the target file is modified more than the modified time of the source file-v shows the process of transferring files- W transfer all Files-z transfer files in a compressed manner--delete Delete The target directory there is, and the source directory does not have files--existing only synchronize files that are common to source and destination files--password-file= file get password from file--progress Show the transfer progress of each file--max-size=size does not transfer files larger than size --min-size=size does not transfer files smaller than size
Common parameter combination:-AVZ
Example
Copy all files under the/wwwroot directory of the current host to the 192.168.1.1/wwwroot directory:
rsync -avz /wwwroot root@192.168.1.1:/wwwroot
Copy all files under the/wwwroot directory of the current host to the 192.168.1.1/wwwroot directory, 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 222) to the/tmp directory of the current host, we can do this:
‘ssh -p 222‘ root@192.168.1.1:/root/file /tmp/
rsync Command Detailed