Suppose you have a directory called source
, and you want to back it up into the directory destination
. To accomplish that, you’d use:
rsync -a source/ destination/
Just to whet your appetite, here’s a way to do the same thing as in the example above, but with destination
on a remote machine, over a secure shell:
rsync -a -e ssh source/ username@remotemachine.com:/path/to/destination/
or
rsync -Pavz source/ username@remotemachine.com:/path/to/destination/
Where
-P same as –partial –progress
-a archive mode; equals -rlptgoD (no -H,-A,-X)
-v, –verbose increase verbosity
-z, –compress – With this option, rsync compresses the file data as it is sent to the destination machine, which reduces the amount of data being transmitted — something that is useful over a slow connection.