Rsync Examples


A few examples of how I use rsync to copy files between hosts and drives.

basic local sync:

rsync -hrtP /path/to/source/ /path/to/destination/

sync remote to local:

rsync -hrtP /home/user/files/

sync local to remote:

rsync -hrtP /home/user/files/

custom ssh port:

rsync -hrtP -e "ssh -p 4220" /home/user/files/

Explanation of Arguments

Additional Arguments to Consider


To delete anything found in the destination, which is not found in the source, add --delete to the end of your command.


To perform a dry-run which only logs the results without actually changing anything, add --dry-run to the end of your command.