Read the manual
Read the list of short options https://linux.die.net/man/1/rsync to get a feeling of what is possible. It is really impressive.
Experiment with basic use cases
Get familiar with some basic uses.
-n) to get feedback on what rsync is about to do.
rsync -avn . /target/di
Archives file attributes (
-a), displays the progress (
-v), does a dry-run (
-n). The command uses the short form of
-a) which translates to (
-r - recursive copy
-l - copy symlinks as symlinks
-p - set permissions to be the same as the source
-t - set mtime to be the same as the source. Use this to support fast incremental updates based on mtime.
-g - set group to be the same as the source
-o - set owner to be the same as the source
-D - if remote user is superuser this recreates devices and other special files
Selection of some cool options
This will remove copied files from source.
This forces rsync to skip any files which exist on the destination and have a modified time that is newer than the source file.
Delete files that does not exist in source tree.
Make a backup of modified or removed files.
Specify a backup dir.
What to copy?
Do not copy empty files.
Copy only small files. Can be used to handle small and large files differently.
Only overrides files that already exist on the target. Do not create new files on target.
Only copy files that do not exist on target.
Define excludes in a file.
Scheduling, Bandwidth and Performance
Ends rsync after a certain time limit.
Ends rsync at a specific time.
Allows partial copies in case of interruptions.
Limits bandwidth Specify KBytes/second. Good option if transfer of large files is required.
-h output numbers in a human-readable format.
--progress display progress.
-i log change info.
--log-file= define a log file.
--quiet no output.