Skip to content

rsync

Two use cases:

  • pull data from A to B
  • push data from A to B

Two access modes:

  • access via remote shell
  • access via rsync daemon
rsync(1)                                                                                       rsync(1)

NAME
       rsync - a fast, versatile, remote (and local) file-copying tool

SYNOPSIS
       Local:  rsync [OPTION...] SRC... [DEST]

       Access via remote shell:
         Pull: rsync [OPTION...] [USER@]HOST:SRC... [DEST]
         Push: rsync [OPTION...] SRC... [USER@]HOST:DEST

       Access via rsync daemon:
         Pull: rsync [OPTION...] [USER@]HOST::SRC... [DEST]
               rsync [OPTION...] rsync://[USER@]HOST[:PORT]/SRC... [DEST]
         Push: rsync [OPTION...] SRC... [USER@]HOST::DEST
               rsync [OPTION...] SRC... rsync://[USER@]HOST[:PORT]/DEST

OPTIONS
-a, --archive               archive mode;
-v, --verbose               increase verbosity
-r, --recursive             recurse into directories
-z, --compress              compress file data during the transfer
--delete            This tells rsync to delete extraneous files from the receiving side
-n, --dry-run               This makes rsync perform a trial run that doesn’t make any changes 

Use case: Move files from remote to local

rsync -avrz xander@poseidon.internal:~/source ~/destination

Use case: Move files from local to remote

rsync -avrz ~/source xander@poseidon.internal:~/destination

Use case: Sync local folder to remote

rsync -avrz --delete dir/ xander@poseidon.internal:~/dir

Example:

rsync -avrz --delete Books/ xander@poseidon.internal:/data/volume2/xander/Documents/Books/