Forrest logo
back to the rsync tool


rsync: Transfer a file in [a]rchive (to preserve attributes) and compressed ([z]ipped) mode displaying [v]erbose and [h]uman-readable [P]rogress.
$ rsync -azvhP ${path-to-local_file} ${remote_host}:${path-to-remote_directory}
try on your machine

This command is using the "rsync" utility to synchronize files between a local and a remote directory.

Here is a breakdown of the command:

  • rsync: The command itself, used for file synchronization.
  • -azvhP: These are options passed to rsync:
    • -a: "Archive" mode, which preserves various attributes of the files during synchronization, such as timestamps, permissions, and ownership.
    • -z: Enables compression during file transfer to reduce the amount of data transmitted.
    • -v: "Verbose" mode, which displays detailed information about the synchronization process.
    • -h: Print numbers in a more human-readable format (e.g. 1K, 234M, 2G).
    • -P: Combines the -p (progress) and --partial options. It shows a progress bar during file transfers and allows for resuming interrupted transfers.
  • ${path-to-local_file}: This is the path to the local file you want to synchronize.
  • ${remote_host}: This is the remote host or IP address where the files will be synchronized.
  • ${path-to-remote_directory}: This is the path to the remote directory where you want to synchronize the files.

So, when you run the command, rsync will compare the local file with the remote directory and transfer any differences between them. The -azvhP options ensure that the synchronization is done efficiently and with informative progress messages.

This explanation was created by an AI. In most cases those are correct. But please always be careful and never run a command you are not sure if it is safe.
back to the rsync tool