Rsync Cheat Sheet

Rsync Common Switches

-a archive i.e recursion
-v verbose output
-h human readable progress
-z compress during data transfer
-e use ssh protocol for transfer

Local To Local

rsync -vhz  localfile /localdir/
rsync -avzh /fromdir/subdir /todir/subdir/

Local To Remote

rsync -vhz  somefile user@ip-or-hotname:/home/
rsync -azvh somedir user@ip-or-hotname:/home/

Remote To Local

rsync -vhz  somefile user@ip-or-hotname:/home/
rsync -azvh somedir user@ip-or-hotname:/home/

Rsync Over SSH

This is done by applying the ā€œeā€ switch i.e

Local To Remote Over SSH

rsync -vhze ssh somefile user@ip-or-hotname:/home/
rsync -azvhe ssh somedir user@ip-or-hotname:/home/

Remote To Local Over SSH

rsync -vzhe  ssh user@ip-or-hotname:/home/filename /localdir/subdir
rsync -avzhe ssh user@ip-or-hotname:/home/directory/subdir /localdir/subdir