OwnBlog from DimiG    About    Archive    RSS

Rsync HowTo

In this post I wanna give a clue how to use well known and famous Open Source rsync program for directories synchronization. rsync is a widely-used utility to keep copies of a file on two computer systems are same. It is commonly found on Unix-like systems and functions as both a file synchronization and file transfer program. The rsync algorithm, a type of delta encoding, is used to minimize network usage. Zlib may be used for additional compression, and SSH or stunnel can be used for data security. Sure, you can read about in Wikipedia, but my goal is to give the short and clear command example here.

Generic syntax:

rsync [OPTION] … SRC [SRC] … [USER@]HOST:DEST
rsync [OPTION] … [USER@]HOST:SRC [DEST]

…where SRC is the file or directory (or a list of multiple files and directories) to copy from, and DEST represents the file or directory to copy to. (Square brackets indicate optional parameters.)

My tips for remote ssh server are something like this
( . means current directory on local system):

$ rsync -avzP username@remoteHost:~/path2sourceDir/ .

If you want to test it without actual synchronization you can use such command:

$ rsync -niavzP username@remoteHost:~/path2sourceDir/ .

Thank you for attention.