Rsync

From WhyAskWhy.org Wiki
Jump to: navigation, search


Summary

The rsync command can be used to synchronize local content or content (usually directories) between two servers. It is common to use rsync over SSH for this purpose.

Examples

  • rsync -a --progress USER@FQDN-OF-REMOTE-HOST:/remote_dir/ /local_dir/
  • rsync -a --progress USER@1.2.3.4:/remote_dir/ /local_dir/
  • rsync -a --progress /local_dir/ USER@1.2.3.4:/remote_dir/

The -a flag is one of the better options to use as it preserves both ownership and permissions. It's also advisable to run this under screen or tmux for remote hosts in case the SSH connection is severed.

References