Last Updated: Mar. 19th 2022 at 1:22am Tags: blog linux rsync

This article is my reference for everything to do with Rsync. I use Rsync for docker containers, backups and moving servers.


This article is my reference for everything to do with Rsync.
I primarily use Rsync for backups and moving servers.

Rsync is the best way (that I’m currently aware of) to transfer files. Only use Rsync when you need to copy files more than once.
Here are some examples of how Rsync may be used.

  • Backing up from server to server using ssh
  • Backing up from drive to drive on the same server
  • Moving from one server to the other (first for a copy then second to move/delete the files at launch)

Nick’s Rsync examples

Rsync through ssh.

#synchronize backups to the local machine
rsync -e ssh -avzu -c -C root@ /Backups/ServerTen/

Do you have any Rsync tricks you use? post them to the comments section.

Rsync Parameters

I wanted a quick reference for Rsync parameters so I didn’t have to weed through the man pages. Here are my most used parameters:

 -q, --quiet                 suppress non-error messages
 -c, --checksum              skip based on checksum, not mod-time & size
 -a, --archive               archive mode; equals -rlptgoD (no -H,-A,-X)
 -r, --recursive             recurse into directories
 -u, --update                skip files that are newer on the receiver
 -d, --dirs                  transfer directories without recursing
 -l, --links                 copy symlinks as symlinks
 -L, --copy-links            transform symlink into referent file/dir
 -k, --copy-dirlinks         transform symlink to dir into referent dir
 -K, --keep-dirlinks         treat symlinked dir on receiver as dir
 -H, --hard-links            preserve hard links
 -p, --perms                 preserve permissions
 -E, --executability         preserve executability
     --chmod=CHMOD           affect file and/or directory permissions
 -A, --acls                  preserve ACLs (implies -p)
 -X, --xattrs                preserve extended attributes
 -o, --owner                 preserve owner (super-user only)
 -g, --group                 preserve group
 -t, --times                 preserve modification times
 -n, --dry-run               perform a trial run with no changes made
 -W, --whole-file            copy files whole (w/o delta-xfer algorithm)
 -x, --one-file-system       don't cross filesystem boundaries
 -B, --block-size=SIZE       force a fixed checksum block-size
 -e, --rsh=COMMAND           specify the remote shell to use
     --rsync-path=PROGRAM    specify the rsync to run on remote machine
     --delete-before         receiver deletes before transfer (default)
 -I, --ignore-times          don't skip files that match size and time
 -z, --compress              compress file data during the transfer
 -h, --human-readable        output numbers in a human-readable format

Pro tip: use Rsync in a screen session in case you loose your connection.

Rsync Snippets

Only copy directory structure not files

rsync -a --include='*/' --exclude='*' source/ destination/



You need to login to comment.