rsync

Linux · Network · available in the simulator

What it does

Synchronizes files and directories locally or remotely, copying only differences.

Syntax

rsync [opciones] origen destino

Options and parameters

  • -a

    Archive mode: recursive, preserving permissions, timestamps, and symlinks.

    rsync -av origen/ destino/
  • -v

    Increase verbosity (display transferred files).

  • -z

    Compress file data during the transfer.

  • -P

    Show progress and allow resuming interrupted transfers.

  • --delete

    Delete extraneous files from the destination directory.

  • -n

    Perform a dry run without making any changes.

    rsync -avn origen/ destino/
  • --exclude

    Exclude files matching the specified pattern.

  • -e

    Specify the remote shell to use, typically ssh.

Usage examples

  • rsync -av origen/ destino/
  • rsync -avn origen/ destino/

Notes and common mistakes

  • A trailing slash on the source copies the contents; omitting it copies the directory itself.
Practise rsync

Related commands