The rsync command enables you to replicate files and directories while keeping ownership and permissions. It also offers extra capabilities like compression and incremental updates.

The -a switch enables “archive” mode, which allows you to use rsync to transfer a directory while preserving ownership and rights. For instance

rsync -a /source/directory /destination/directory <===> This example shows how to use rsync to copy directories on the local machine. You can also use it the same way shown for scp if you want to use rsync to copy directories to remote servers.