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, -vincrease verbosity
--quiet, -qsuppress non-error messages
--no-motdsuppress daemon­-mode MOTD (see manpage caveat)
--chec­ksum, -cskip based on checksum, not mod-time & size
--archive, -aarchive mode; equals -rlptgoD (no -H,-A,-X)
--no-O­PTIONturn off an implied OPTION (e.g. --no-D)
--recu­rsive, -rrecurse into direct­ories
--rela­tive, -Ruse relative path names
--no-i­mpl­ied­-dirsdon't send implied dirs with --relative
--backup, -bmake backups (see --suffix & --back­up-dir)
--back­up-­dir=DIRmake backups into hierarchy based in DIR
--suff­ix=­SUFFIXset backup suffix (default ~ w/o --back­up-dir)
--update, -uskip files that are newer on the receiver
--inplaceupdate destin­ation files in-place (SEE MAN PAGE
--appendappend data onto shorter files
--appe­nd-­verifylike --append, but with old data in file checksum
--dirs, -dtransfer direct­ories without recursing
--links, -lcopy symlinks as symlinks
--copy­-links, -Ltransform symlink into referent file/dir
--copy­-un­saf­e-linksonly "­uns­afe­" symlinks are transf­ormed
--safe­-linksignore symlinks that point outside the source tree
--copy­-di­rlinks, -ktransform symlink to a dir into referent dir
--keep­-di­rlinks, -Ktreat symlinked dir on receiver as dir
--hard­-links, -Hpreserve hard links
--perms, -ppreserve permis­sions
--exec­uta­bility, -Epreserve the file's execut­ability
--chmo­d=CHMODaffect file and/or directory permis­sions
--acls, -Apreserve ACLs (implies --perms)
--xattrs, -Xpreserve extended attributes
--owner, -opreserve owner (super­-user only)
--group, -gpreserve group
--devicespreserve device files (super­-user only)
--specialspreserve special files
-Dsame as --devices --special
--times, -tpreserve modifi­cation times
--omit­-di­r-t­imes, -Oomit direct­ories from --times
--superreceiver attempts super-user activities
--fake­-superstore/­recover privileged attrs using xattrs
 

rsync Options contd.

--sparse, -Shandle sparse files effici­ently
--dry-run, -nperform a trial run with no changes made
--whol­e-file, -Wcopy files whole (without delta-xfer algorithm)
--one-­fil­e-s­ystem, -xdon't cross filesystem boundaries
--bloc­k-s­ize­=SIZEforce a fixed checksum block-size
--rsh=­COM­MAND, -especify the remote shell to use
--rsyn­c-p­ath­=PR­OGRAMspecify the rsync to run on the remote machine
--existingskip creating new files on receiver
--igno­re-­exi­stingskip updating files that already exist on receiver
--remo­ve-­sou­rce­-filessender removes synchr­onized files (non-dirs)
--delan alias for --dele­te-­during
--deletedelete extraneous files from destin­ation dirs
--dele­te-­beforereceiver deletes before transfer, not during
--dele­te-­duringreceiver deletes during transfer (default)
--dele­te-­delayfind deletions during, delete after
--dele­te-­afterreceiver deletes after transfer, not during
--dele­te-­exc­ludedalso delete excluded files from destin­ation dirs
--igno­re-­errorsdelete even if there are I/O errors
--forceforce deletion of direct­ories even if not empty
--max-­del­ete=NUMdon't delete more than NUM files
--max-­siz­e=SIZEdon't transfer any file larger than SIZE
--min-­siz­e=SIZEdon't transfer any file smaller than SIZE
--partialkeep partially transf­erred files
--part­ial­-di­r=DIRput a partially transf­erred file into DIR
--dela­y-u­pdatesput all updated files into place at transfer's end
--prun­e-e­mpt­y-dirs, -mprune empty directory chains from the file-list
--nume­ric-idsdon't map uid/gid values by user/group name
--time­out­=SE­CONDSset I/O timeout in seconds
--cont­imeoutset daemon connection timeout in seconds
--igno­re-­times, -Idon't skip files that match in size and mod-time
--size­-onlyskip files that match in size
--modi­fy-­win­dow=NUMcompare mod-times with reduced accuracy
--temp­-dir, -Tcreate temporary files in directory DIR
--fuzzy, -yfind similar file for basis if no dest file
--comp­are­-de­st=DIRalso compare destin­ation files relative to DIR
--copy­-de­st=DIR... and include copies of unchanged files
--link­-de­st=DIRhardlink to files in DIR when unchanged
--comp­ress, -zcompress file data during the transfer
 

rsync Options cont'd.

--comp­res­s-l­eve­l=NUMexplicitly set compre­ssion level
--skip­-co­mpr­ess­=LISTskip compre­ssing files with a suffix in LIST
--cvs-­exc­lude, -Cauto-i­gnore files the same way CVS does
--filt­er=­RULE, -fadd a file-f­ilt­ering RULE
-Fsame as --filt­er=­'di­r-merge /.rsyn­c-f­ilter'
 repeated: --filt­er='- .rsync­-fi­lter'
--excl­ude­=PA­TTERNexclude files matching PATTERN
--excl­ude­-fr­om=FILEread exclude patterns from FILE
--incl­ude­=PA­TTERNdon't exclude files matching PATTERN
--incl­ude­-fr­om=FILEread include patterns from FILE
--file­s-f­rom­=FILEread list of source­-file names from FILE
--from0, -0all *-from­/filter files are delimited by 0s
--prot­ect­-args, -sno space-­spl­itting; only wildcard specia­l-chars
--addr­ess­=AD­DRESSbind address for outgoing socket to daemon
--port­=PORTspecify double­-colon alternate port number
--sock­opt­s=O­PTIONSspecify custom TCP options
--bloc­king-iouse blocking I/O for the remote shell
--statsgive some file-t­ransfer stats
--8-bi­t-o­utput, -8leave high-bit chars unescaped in output
--huma­n-r­eadble, -houtput numbers in a human-­rea­dable format
--progressshow progress during transfer
-Psame as --partial --progress
--item­ize­-ch­anges, -ioutput a change­-su­mmary for all updates
--out-­for­mat­=FORMAToutput a change­-su­mmary for all updates
--log-­fil­e=FILElog what we're doing to the specified FILE
--log-­fil­e-f­orm­at=FMTlog updates using the specified FMT
--pass­wor­d-f­ile­=FILEread daemon­-access password from FILE
--list­-onlylist the files instead of copying them
--bwli­mit­=KBPSlimit I/O bandwidth; KBytes per second
--writ­e-b­atc­h=FILEwrite a batched update to FILE
--only­-wr­ite­-ba­tch­=FILElike --writ­e-batch but w/o updating destin­ation
--read­-ba­tch­=FILEread a batched update from FILE
--prot­oco­l=NUMforce an older protocol version to be used
--icon­v=C­ONV­ERT­_SPECrequest charset conversion of filenames
--ipv4, -4prefer IPv4
--ipv6, -6prefer IPv6
--versionprint version number
--help, -hshow 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.