How to use rsync

The basic syntax of rsync is very simple, where the content of dir1 is sync to the dir2. Flag -r is for recursively syncing directory. More details can be found at digitalocean.

rsync -r dir1/ dir2

How To Use Rsync to Sync with a Remote System

Syncing to a remote system is easy provided, you have SSH access to the remote machine and rsync installed on both the computers.

rsync -a ~/dir1 username@remote_host:destination_path

List of useful rsync flags

-z                             for compressing the files to be transferred

-P                            It combines the flags –progress and –partial. It gives progress bar for                                      the transfers and second allows you to resume interrupted transfers.

More details can be found at rsync help page

rsync --help