Option available in `rsync` command in Linux

Options

Description

a, –archive

This is equivalent to using -rlptgoD. Archive mode includes all the necessary options like copying files recursively, preserving almost everything (like symbolic links, file permissions, user & group ownership and timestamps).

-v, –verbose

By default, rsync operates silently. Using a single “-v” option provides information on transferred files and a summary at the end. Adding two “-v” options gives status updates on delta-transmission and skipped files, along with more information at the end. Multiple “-v” options are typically used for debugging rsync.

-h, –human-readable format

Outputs in a human readable format.

-z, –compress

Compress file data during the transfer

rsync command in Linux with Examples

rsync or remote synchronization is a software utility for Unix-Like systems that efficiently sync files and directories between two hosts or machines. One is the source or the local-host from which the files will be synced, the other is the remote-host, on which synchronization will take place. There are basically two ways in which rsync can copy/sync data:

  • Copying/syncing to/from another host over any remote shell like ssh, rsh.
  • Copying/Syncing through rsync daemon using TCP.

Rsync is famous for its delta-transfer algorithm, in which it copies only the differences between the source files present in the local-host and the existing files in the destination or the remote host.

Example:

rsync local-file user@remote-host:remote-file

What Happens Here:

Rsync will first use SSH to connect as the user to remote-host and will ask for user's password. Once connected, it will invoke the remote host’s rsync, and then the two programs will determine what parts of the local-file need to be copied so that the remote file matches the local one. Please note the following behavior of rsync:

  • Files that do not exist on the remote-host are copied.
  • Files that have been updated will be synced, rsync will copy only the changed parts of files to the remote host.
  • files that are exactly the same are not copied to the remote host.

Similar Reads

Syntax of `rsync` command in Linux

rsync [options] source [destination]...

Option available in `rsync` command in Linux

...

Examples

Using `rsync` as a list command...