Rsync - Simple Guide

Rsync is intelligent in determining if any changes have been made in the source.

Rsync is an excellent file copying and syncronization tool. It can be a very good alternative to FTP since it is efficient (it does not transfer files which are already in sync), safe (uses SSH protocol) and offers a lot of other useful functions.

 Here are some of the common flags of RSYNC

-z Use compression (Useful when you are transferring data over network)
-a Archive (Syncs recursively and preserves symbolic links, special devices, modification times, group, owner and permissions.
-n Dry run (Do not actually perform the operation )
-v Verbose (Display information)
-P Combines --progress and --partial flags. The first one gives you a progress bar for each transfers and the second one allows you to resume interrupted transfers.

Rsync is intelligent in determining if any changes have made in the source. It uses modification times to determine the changes. By default rsync does not delete files from the destination directory. The flag --delete changes this behaviour.

Syntax: (simple)

rsync -aznvP <source>/ <destination> 


rsync -a dir1/ username@remote_host:/path/to/destination/directory

rsync -azP username@remote_host:/path/to/destination/directory/ /local/folder

Note the slash at the end of source. It means the contents of the directory. Also double check your arguments before executing an rsync command.