rsync
rsync
According to Wikipedia, “rsync (remote sync) is a utility for transferring and synchronizing files between a computer and a storage drive and across networked computers by comparing the modification times and sizes of files.”
rsync -avz src/ dest/
rsync -avz src/ user@example.org:/home/user/dest/a note on trailing slashes
Since i forget it all the time.
And it makes all the difference.
rsync -avz src dest/This command copies src into dest, resulting in dest/src.
rsync -avz src/ dest/This command copies the contents of src into dest. If coupled with --delete flag, it basically replaces the contents of dest with that of src.
Flags I use
-a/--archive- archive mode (synchronizes directories recursively, keeps ownership of users and groups, permissions, symbolic links and timestamps.
-v/--verbose- increase verbosity
-z/--compress- compress file data during the transfer
-P/--partial --progress--partial: keep partially transferred files--progress: show progress during transfer
--delete- deletes files in the destination directory if they don’t exist in the source directory
Custom SSH port
If your SSH server uses, say 8022 as SSH port, you can define it like so:
rsync -e 'ssh -p 8022' ...