How to copy data from local to remote server via rsync

To copy files from one remote location to a local server  using rsync:

rsync -av user@host:/path/to/directory /path/to/directory

Flags:
-a: Archive, syncs recursively and preserves symbolic links, special and device files, modification times, groups, owners, and permissions.
-v: Verbose, prints information about what files are being transferred and a brief summary at the end

To copy files from the local server to the remote  using rsync:

rsync -av /path/to/local/directory user@host:/path/to/remoter/directory

rsync documentation