Rsync, (remote sync), is a remote & local file synchronization tool. It uses a special way that minimizes the amount of data copied by only moving the portions of files that have changed(which is will be fast and save bandwidth).
Rsync structure is:rsync <option> <src> <destination>
options for rSync:
-v: Tells rsync to run into verbose mode
-r: Recursive, required for directory syncing.
-a: A combination flag that stands for “archive”.
-n is for “-dry-run” flag.
-z: compress file data during the transfer
-P: same as –partial –progress
Rsync over a remote connection
1 2 3 4 5 | rsync -arz <local_dir> <username>@<remote_host>:<destination_dir> |
Using ssh with rsync
1 2 3 4 5 | rsync -anzP -e "ssh -p port" user@host::source/remote/path /dest/path |
1 2 3 4 5 | rsync -anzP -e "ssh -p port" /local/path user@host::remote/path |