Show Menu

rsync Cheat Sheet by richardjh

rsync is a file transfer program capable of efficient remote update via a fast differencing algorithm.

rsync Usage

rsync [OPTIO­N]... SRC [SRC]... DEST
rsync [OPTIO­N]... SRC [SRC]... [USER@­]HO­ST:DEST
rsync [OPTIO­N]... SRC [SRC]... [USER@­]HO­ST:­:DEST
rsync [OPTIO­N]... SRC [SRC]... rsync:­//[­USE­R@]­HOS­T[:­POR­T]/DEST
rsync [OPTIO­N]... [USER@­]HO­ST:SRC [DEST]
rsync [OPTIO­N]... [USER@­]HO­ST::SRC [DEST]
rsync [OPTIO­N]... rsync:­//[­USE­R@]­HOS­T[:­POR­T]/SRC [DEST]
The ':' usages connect via remote shell, while '::' & 'rsync://' usages connect to an rsync daemon, and require SRC or DEST to start with a module name.

rsync Options

--verbose, -v
increase verbosity
--quiet, -q
suppress non-error messages
--no-motd
suppress daemon­-mode MOTD (see manpage caveat)
--chec­ksum, -c
skip based on checksum, not mod-time & size
--archive, -a
archive mode; equals -rlptgoD (no -H,-A,-X)
--no-O­PTION
turn off an implied OPTION (e.g. --no-D)
--recu­rsive, -r
recurse into direct­ories
--rela­tive, -R
use relative path names
--no-i­mpl­ied­-dirs
don't send implied dirs with --relative
--backup, -b
make backups (see --suffix & --back­up-dir)
--back­up-­dir=DIR
make backups into hierarchy based in DIR
--suff­ix=­SUFFIX
set backup suffix (default ~ w/o --back­up-dir)
--update, -u
skip files that are newer on the receiver
--inplace
update destin­ation files in-place (SEE MAN PAGE
--append
append data onto shorter files
--appe­nd-­verify
like --append, but with old data in file checksum
--dirs, -d
transfer direct­ories without recursing
--links, -l
copy symlinks as symlinks
--copy­-links, -L
transform symlink into referent file/dir
--copy­-un­saf­e-links
only "­uns­afe­" symlinks are transf­ormed
--safe­-links
ignore symlinks that point outside the source tree
--copy­-di­rlinks, -k
transform symlink to a dir into referent dir
--keep­-di­rlinks, -K
treat symlinked dir on receiver as dir
--hard­-links, -H
preserve hard links
--perms, -p
preserve permis­sions
--exec­uta­bility, -E
preserve the file's execut­ability
--chmo­d=CHMOD
affect file and/or directory permis­sions
--acls, -A
preserve ACLs (implies --perms)
--xattrs, -X
preserve extended attributes
--owner, -o
preserve owner (super­-user only)
--group, -g
preserve group
--devices
preserve device files (super­-user only)
--specials
preserve special files
-D
same as --devices --special
--times, -t
preserve modifi­cation times
--omit­-di­r-t­imes, -O
omit direct­ories from --times
--super
receiver attempts super-user activities
--fake­-super
store/­recover privileged attrs using xattrs
 

rsync Options contd.

--sparse, -S
handle sparse files effici­ently
--dry-run, -n
perform a trial run with no changes made
--whol­e-file, -W
copy files whole (without delta-xfer algorithm)
--one-­fil­e-s­ystem, -x
don't cross filesystem boundaries
--bloc­k-s­ize­=SIZE
force a fixed checksum block-size
--rsh=­COM­MAND, -e
specify the remote shell to use
--rsyn­c-p­ath­=PR­OGRAM
specify the rsync to run on the remote machine
--existing
skip creating new files on receiver
--igno­re-­exi­sting
skip updating files that already exist on receiver
--remo­ve-­sou­rce­-files
sender removes synchr­onized files (non-dirs)
--del
an alias for --dele­te-­during
--delete
delete extraneous files from destin­ation dirs
--dele­te-­before
receiver deletes before transfer, not during
--dele­te-­during
receiver deletes during transfer (default)
--dele­te-­delay
find deletions during, delete after
--dele­te-­after
receiver deletes after transfer, not during
--dele­te-­exc­luded
also delete excluded files from destin­ation dirs
--igno­re-­errors
delete even if there are I/O errors
--force
force deletion of direct­ories even if not empty
--max-­del­ete=NUM
don't delete more than NUM files
--max-­siz­e=SIZE
don't transfer any file larger than SIZE
--min-­siz­e=SIZE
don't transfer any file smaller than SIZE
--partial
keep partially transf­erred files
--part­ial­-di­r=DIR
put a partially transf­erred file into DIR
--dela­y-u­pdates
put all updated files into place at transfer's end
--prun­e-e­mpt­y-dirs, -m
prune empty directory chains from the file-list
--nume­ric-ids
don't map uid/gid values by user/group name
--time­out­=SE­CONDS
set I/O timeout in seconds
--cont­imeout
set daemon connection timeout in seconds
--igno­re-­times, -I
don't skip files that match in size and mod-time
--size­-only
skip files that match in size
--modi­fy-­win­dow=NUM
compare mod-times with reduced accuracy
--temp­-dir, -T
create temporary files in directory DIR
--fuzzy, -y
find similar file for basis if no dest file
--comp­are­-de­st=DIR
also compare destin­ation files relative to DIR
--copy­-de­st=DIR
... and include copies of unchanged files
--link­-de­st=DIR
hardlink to files in DIR when unchanged
--comp­ress, -z
compress file data during the transfer
 

rsync Options cont'd.

--comp­res­s-l­eve­l=NUM
explicitly set compre­ssion level
--skip­-co­mpr­ess­=LIST
skip compre­ssing files with a suffix in LIST
--cvs-­exc­lude, -C
auto-i­gnore files the same way CVS does
--filt­er=­RULE, -f
add a file-f­ilt­ering RULE
-F
same as --filt­er=­'di­r-merge /.rsyn­c-f­ilter'
 
repeated: --filt­er='- .rsync­-fi­lter'
--excl­ude­=PA­TTERN
exclude files matching PATTERN
--excl­ude­-fr­om=FILE
read exclude patterns from FILE
--incl­ude­=PA­TTERN
don't exclude files matching PATTERN
--incl­ude­-fr­om=FILE
read include patterns from FILE
--file­s-f­rom­=FILE
read list of source­-file names from FILE
--from0, -0
all *-from­/filter files are delimited by 0s
--prot­ect­-args, -s
no space-­spl­itting; only wildcard specia­l-chars
--addr­ess­=AD­DRESS
bind address for outgoing socket to daemon
--port­=PORT
specify double­-colon alternate port number
--sock­opt­s=O­PTIONS
specify custom TCP options
--bloc­king-io
use blocking I/O for the remote shell
--stats
give some file-t­ransfer stats
--8-bi­t-o­utput, -8
leave high-bit chars unescaped in output
--huma­n-r­eadble, -h
output numbers in a human-­rea­dable format
--progress
show progress during transfer
-P
same as --partial --progress
--item­ize­-ch­anges, -i
output a change­-su­mmary for all updates
--out-­for­mat­=FORMAT
output a change­-su­mmary for all updates
--log-­fil­e=FILE
log what we're doing to the specified FILE
--log-­fil­e-f­orm­at=FMT
log updates using the specified FMT
--pass­wor­d-f­ile­=FILE
read daemon­-access password from FILE
--list­-only
list the files instead of copying them
--bwli­mit­=KBPS
limit I/O bandwidth; KBytes per second
--writ­e-b­atc­h=FILE
write a batched update to FILE
--only­-wr­ite­-ba­tch­=FILE
like --writ­e-batch but w/o updating destin­ation
--read­-ba­tch­=FILE
read a batched update from FILE
--prot­oco­l=NUM
force an older protocol version to be used
--icon­v=C­ONV­ERT­_SPEC
request charset conversion of filenames
--ipv4, -4
prefer IPv4
--ipv6, -6
prefer IPv6
--version
print version number
--help, -h
show this help ( -h works with no other options )
Please see the rsync(1) and rsyncd.co­nf(5) man pages for full docume­nta­tion.
See http:/­/rs­ync.sa­mba.org/ for updates, bug reports, and answers
 

Share This Cheat Sheet!

Favourited by 7 Members:

Theosis akipta sebbu xcession zenweasel powareverb LockeCJ

Comments

DarrinC DarrinC, 17:19 12 Oct 12

Nice. Thanks!

Add a Comment

Your Comment

Please enter your name.

    Please enter your email address

      Please enter your Comment.