rsync is similar to scp but is especially useful for keeping
two directories in sync, for example, when you want to copy only the
differences between a local and remote directory. This makes it efficient
for repeated transfers or incremental updates. It uses SSH internally, so you would authenticate with your password or SSH keys.
Unlike scp, rsync only transfers files that have changed, making it ideal for synchronizing large directories or backups.
To copy a local file or directory to a remote system:
$ rsync -av paper/ scf1@arwen.berkeley.edu:/tmp/paper/
scf1@arwen.berkeley.edu's password:
sending incremental file list
./
draft.txt
figures/
figures/chart.eps
sent 1,234 bytes received 56 bytes 860.00 bytes/sec
total size is 12,345 speedup is 9.52The options commonly used here are:
-a(archive): preserves file permissions, timestamps, symbolic links, etc.-v(verbose): shows progress messages.
To copy files from the remote system back to your local machine:
$ rsync -avz scf1@arwen.berkeley.edu:/tmp/paper/ paper/
scf1@arwen.berkeley.edu's password:
receiving incremental file list
./
notes.txt
new_results.csv