1rsync(1) User Commands rsync(1)
2
3
4
6 rsync - a fast, versatile, remote (and local) file-copying tool
7
9 Local:
10 rsync [OPTION...] SRC... [DEST]
11
12 Access via remote shell:
13 Pull:
14 rsync [OPTION...] [USER@]HOST:SRC... [DEST]
15 Push:
16 rsync [OPTION...] SRC... [USER@]HOST:DEST
17
18 Access via rsync daemon:
19 Pull:
20 rsync [OPTION...] [USER@]HOST::SRC... [DEST]
21 rsync [OPTION...] rsync://[USER@]HOST[:PORT]/SRC... [DEST]
22 Push:
23 rsync [OPTION...] SRC... [USER@]HOST::DEST
24 rsync [OPTION...] SRC... rsync://[USER@]HOST[:PORT]/DEST)
25
26 Usages with just one SRC arg and no DEST arg will list the source files
27 instead of copying.
28
29 The online version of this manpage (that includes cross-linking of top‐
30 ics) is available at https://download.samba.org/pub/rsync/rsync.1.
31
33 Rsync is a fast and extraordinarily versatile file copying tool. It
34 can copy locally, to/from another host over any remote shell, or
35 to/from a remote rsync daemon. It offers a large number of options
36 that control every aspect of its behavior and permit very flexible
37 specification of the set of files to be copied. It is famous for its
38 delta-transfer algorithm, which reduces the amount of data sent over
39 the network by sending only the differences between the source files
40 and the existing files in the destination. Rsync is widely used for
41 backups and mirroring and as an improved copy command for everyday use.
42
43 Rsync finds files that need to be transferred using a "quick check" al‐
44 gorithm (by default) that looks for files that have changed in size or
45 in last-modified time. Any changes in the other preserved attributes
46 (as requested by options) are made on the destination file directly
47 when the quick check indicates that the file's data does not need to be
48 updated.
49
50 Some of the additional features of rsync are:
51
52 o support for copying links, devices, owners, groups, and permis‐
53 sions
54
55 o exclude and exclude-from options similar to GNU tar
56
57 o a CVS exclude mode for ignoring the same files that CVS would
58 ignore
59
60 o can use any transparent remote shell, including ssh or rsh
61
62 o does not require super-user privileges
63
64 o pipelining of file transfers to minimize latency costs
65
66 o support for anonymous or authenticated rsync daemons (ideal for
67 mirroring)
68
70 Rsync copies files either to or from a remote host, or locally on the
71 current host (it does not support copying files between two remote
72 hosts).
73
74 There are two different ways for rsync to contact a remote system: us‐
75 ing a remote-shell program as the transport (such as ssh or rsh) or
76 contacting an rsync daemon directly via TCP. The remote-shell trans‐
77 port is used whenever the source or destination path contains a single
78 colon (:) separator after a host specification. Contacting an rsync
79 daemon directly happens when the source or destination path contains a
80 double colon (::) separator after a host specification, OR when an
81 rsync:// URL is specified (see also the USING RSYNC-DAEMON FEATURES VIA
82 A REMOTE-SHELL CONNECTION section for an exception to this latter
83 rule).
84
85 As a special case, if a single source arg is specified without a desti‐
86 nation, the files are listed in an output format similar to "ls -l".
87
88 As expected, if neither the source or destination path specify a remote
89 host, the copy occurs locally (see also the --list-only option).
90
91 Rsync refers to the local side as the client and the remote side as the
92 server. Don't confuse server with an rsync daemon. A daemon is always
93 a server, but a server can be either a daemon or a remote-shell spawned
94 process.
95
97 See the file README.md for installation instructions.
98
99 Once installed, you can use rsync to any machine that you can access
100 via a remote shell (as well as some that you can access using the rsync
101 daemon-mode protocol). For remote transfers, a modern rsync uses ssh
102 for its communications, but it may have been configured to use a dif‐
103 ferent remote shell by default, such as rsh or remsh.
104
105 You can also specify any remote shell you like, either by using the -e
106 command line option, or by setting the RSYNC_RSH environment variable.
107
108 Note that rsync must be installed on both the source and destination
109 machines.
110
112 You use rsync in the same way you use rcp. You must specify a source
113 and a destination, one of which may be remote.
114
115 Perhaps the best way to explain the syntax is with some examples:
116
117 rsync -t *.c foo:src/
118
119 This would transfer all files matching the pattern *.c from the current
120 directory to the directory src on the machine foo. If any of the files
121 already exist on the remote system then the rsync remote-update proto‐
122 col is used to update the file by sending only the differences in the
123 data. Note that the expansion of wildcards on the command-line (*.c)
124 into a list of files is handled by the shell before it runs rsync and
125 not by rsync itself (exactly the same as all other Posix-style pro‐
126 grams).
127
128 rsync -avz foo:src/bar /data/tmp
129
130 This would recursively transfer all files from the directory src/bar on
131 the machine foo into the /data/tmp/bar directory on the local machine.
132 The files are transferred in archive mode, which ensures that symbolic
133 links, devices, attributes, permissions, ownerships, etc. are preserved
134 in the transfer. Additionally, compression will be used to reduce the
135 size of data portions of the transfer.
136
137 rsync -avz foo:src/bar/ /data/tmp
138
139 A trailing slash on the source changes this behavior to avoid creating
140 an additional directory level at the destination. You can think of a
141 trailing / on a source as meaning "copy the contents of this directory"
142 as opposed to "copy the directory by name", but in both cases the at‐
143 tributes of the containing directory are transferred to the containing
144 directory on the destination. In other words, each of the following
145 commands copies the files in the same way, including their setting of
146 the attributes of /dest/foo:
147
148 rsync -av /src/foo /dest
149 rsync -av /src/foo/ /dest/foo
150
151 Note also that host and module references don't require a trailing
152 slash to copy the contents of the default directory. For example, both
153 of these copy the remote directory's contents into "/dest":
154
155 rsync -av host: /dest
156 rsync -av host::module /dest
157
158 You can also use rsync in local-only mode, where both the source and
159 destination don't have a ':' in the name. In this case it behaves like
160 an improved copy command.
161
162 Finally, you can list all the (listable) modules available from a par‐
163 ticular rsync daemon by leaving off the module name:
164
165 rsync somehost.mydomain.com::
166
167 See the following section for more details.
168
170 The syntax for requesting multiple files from a remote host is done by
171 specifying additional remote-host args in the same style as the first,
172 or with the hostname omitted. For instance, all these work:
173
174 rsync -aiv host:file1 :file2 host:file{3,4} /dest/
175 rsync -aiv host::modname/file{1,2} host::modname/extra /dest/
176 rsync -aiv host::modname/first ::modname/extra{1,2} /dest/
177
178 In a modern rsync, you only need to quote or backslash-escape things
179 like spaces from the local shell but not also from the remote shell:
180
181 rsync -aiv host:'a simple file.pdf' /dest/
182
183 Really old versions of rsync only allowed specifying one remote-source
184 arg, so it required the remote side to split the args at a space. You
185 can still get this old-style arg splitting by using the --old-args op‐
186 tion:
187
188 rsync -ai --old-args host:'dir1/file1 dir2/file2' /dest
189 rsync -ai --old-args host::'modname/dir1/file1 modname/dir2/file2' /dest
190
191 See that option's section for an environment variable that can be ex‐
192 ported to help old scripts.
193
195 It is also possible to use rsync without a remote shell as the trans‐
196 port. In this case you will directly connect to a remote rsync daemon,
197 typically using TCP port 873. (This obviously requires the daemon to be
198 running on the remote system, so refer to the STARTING AN RSYNC DAEMON
199 TO ACCEPT CONNECTIONS section below for information on that.)
200
201 Using rsync in this way is the same as using it with a remote shell ex‐
202 cept that:
203
204 o you either use a double colon :: instead of a single colon to
205 separate the hostname from the path, or you use an rsync:// URL.
206
207 o the first word of the "path" is actually a module name.
208
209 o the remote daemon may print a message of the day when you con‐
210 nect.
211
212 o if you specify no path name on the remote daemon then the list
213 of accessible paths on the daemon will be shown.
214
215 o if you specify no local destination then a listing of the speci‐
216 fied files on the remote daemon is provided.
217
218 o you must not specify the --rsh (-e) option (since that overrides
219 the daemon connection to use ssh -- see USING RSYNC-DAEMON FEA‐
220 TURES VIA A REMOTE-SHELL CONNECTION below).
221
222 An example that copies all the files in a remote module named "src":
223
224 rsync -av host::src /dest
225
226 Some modules on the remote daemon may require authentication. If so,
227 you will receive a password prompt when you connect. You can avoid the
228 password prompt by setting the environment variable RSYNC_PASSWORD to
229 the password you want to use or using the --password-file option. This
230 may be useful when scripting rsync.
231
232 WARNING: On some systems environment variables are visible to all
233 users. On those systems using --password-file is recommended.
234
235 You may establish the connection via a web proxy by setting the envi‐
236 ronment variable RSYNC_PROXY to a hostname:port pair pointing to your
237 web proxy. Note that your web proxy's configuration must support proxy
238 connections to port 873.
239
240 You may also establish a daemon connection using a program as a proxy
241 by setting the environment variable RSYNC_CONNECT_PROG to the commands
242 you wish to run in place of making a direct socket connection. The
243 string may contain the escape "%H" to represent the hostname specified
244 in the rsync command (so use "%%" if you need a single "%" in your
245 string). For example:
246
247 export RSYNC_CONNECT_PROG='ssh proxyhost nc %H 873'
248 rsync -av targethost1::module/src/ /dest/
249 rsync -av rsync://targethost2/module/src/ /dest/
250
251 The command specified above uses ssh to run nc (netcat) on a proxyhost,
252 which forwards all data to port 873 (the rsync daemon) on the targeth‐
253 ost (%H).
254
255 Note also that if the RSYNC_SHELL environment variable is set, that
256 program will be used to run the RSYNC_CONNECT_PROG command instead of
257 using the default shell of the system() call.
258
260 It is sometimes useful to use various features of an rsync daemon (such
261 as named modules) without actually allowing any new socket connections
262 into a system (other than what is already required to allow remote-
263 shell access). Rsync supports connecting to a host using a remote
264 shell and then spawning a single-use "daemon" server that expects to
265 read its config file in the home dir of the remote user. This can be
266 useful if you want to encrypt a daemon-style transfer's data, but since
267 the daemon is started up fresh by the remote user, you may not be able
268 to use features such as chroot or change the uid used by the daemon.
269 (For another way to encrypt a daemon transfer, consider using ssh to
270 tunnel a local port to a remote machine and configure a normal rsync
271 daemon on that remote host to only allow connections from "localhost".)
272
273 From the user's perspective, a daemon transfer via a remote-shell con‐
274 nection uses nearly the same command-line syntax as a normal rsync-dae‐
275 mon transfer, with the only exception being that you must explicitly
276 set the remote shell program on the command-line with the --rsh=COMMAND
277 option. (Setting the RSYNC_RSH in the environment will not turn on this
278 functionality.) For example:
279
280 rsync -av --rsh=ssh host::module /dest
281
282 If you need to specify a different remote-shell user, keep in mind that
283 the user@ prefix in front of the host is specifying the rsync-user
284 value (for a module that requires user-based authentication). This
285 means that you must give the '-l user' option to ssh when specifying
286 the remote-shell, as in this example that uses the short version of the
287 --rsh option:
288
289 rsync -av -e "ssh -l ssh-user" rsync-user@host::module /dest
290
291 The "ssh-user" will be used at the ssh level; the "rsync-user" will be
292 used to log-in to the "module".
293
295 In order to connect to an rsync daemon, the remote system needs to have
296 a daemon already running (or it needs to have configured something like
297 inetd to spawn an rsync daemon for incoming connections on a particular
298 port). For full information on how to start a daemon that will han‐
299 dling incoming socket connections, see the rsyncd.conf(5) manpage --
300 that is the config file for the daemon, and it contains the full de‐
301 tails for how to run the daemon (including stand-alone and inetd con‐
302 figurations).
303
304 If you're using one of the remote-shell transports for the transfer,
305 there is no need to manually start an rsync daemon.
306
308 Rsync always sorts the specified filenames into its internal transfer
309 list. This handles the merging together of the contents of identically
310 named directories, makes it easy to remove duplicate filenames, and may
311 confuse someone when the files are transferred in a different order
312 than what was given on the command-line.
313
314 If you need a particular file to be transferred prior to another, ei‐
315 ther separate the files into different rsync calls, or consider using
316 --delay-updates (which doesn't affect the sorted transfer order, but
317 does make the final file-updating phase happen much more rapidly).
318
320 Here are some examples of how I use rsync.
321
322 To backup my wife's home directory, which consists of large MS Word
323 files and mail folders, I use a cron job that runs
324
325 rsync -Cavz . arvidsjaur:backup
326
327 each night over a PPP connection to a duplicate directory on my machine
328 "arvidsjaur".
329
330 To synchronize my samba source trees I use the following Makefile tar‐
331 gets:
332
333 get:
334 rsync -avuzb --exclude '*~' samba:samba/ .
335 put:
336 rsync -Cavuzb . samba:samba/
337 sync: get put
338
339 This allows me to sync with a CVS directory at the other end of the
340 connection. I then do CVS operations on the remote machine, which
341 saves a lot of time as the remote CVS protocol isn't very efficient.
342
343 I mirror a directory between my "old" and "new" ftp sites with the com‐
344 mand:
345
346 rsync -az -e ssh --delete ~ftp/pub/samba nimbus:"~ftp/pub/tridge"
347
348 This is launched from cron every few hours.
349
351 Here is a short summary of the options available in rsync. Each option
352 also has its own detailed description later in this manpage.
353
354 --verbose, -v increase verbosity
355 --info=FLAGS fine-grained informational verbosity
356 --debug=FLAGS fine-grained debug verbosity
357 --stderr=e|a|c change stderr output mode (default: errors)
358 --quiet, -q suppress non-error messages
359 --no-motd suppress daemon-mode MOTD
360 --checksum, -c skip based on checksum, not mod-time & size
361 --archive, -a archive mode is -rlptgoD (no -A,-X,-U,-N,-H)
362 --no-OPTION turn off an implied OPTION (e.g. --no-D)
363 --recursive, -r recurse into directories
364 --relative, -R use relative path names
365 --no-implied-dirs don't send implied dirs with --relative
366 --backup, -b make backups (see --suffix & --backup-dir)
367 --backup-dir=DIR make backups into hierarchy based in DIR
368 --suffix=SUFFIX backup suffix (default ~ w/o --backup-dir)
369 --update, -u skip files that are newer on the receiver
370 --inplace update destination files in-place
371 --append append data onto shorter files
372 --append-verify --append w/old data in file checksum
373 --dirs, -d transfer directories without recursing
374 --old-dirs, --old-d works like --dirs when talking to old rsync
375 --mkpath create the destination's path component
376 --links, -l copy symlinks as symlinks
377 --copy-links, -L transform symlink into referent file/dir
378 --copy-unsafe-links only "unsafe" symlinks are transformed
379 --safe-links ignore symlinks that point outside the tree
380 --munge-links munge symlinks to make them safe & unusable
381 --copy-dirlinks, -k transform symlink to dir into referent dir
382 --keep-dirlinks, -K treat symlinked dir on receiver as dir
383 --hard-links, -H preserve hard links
384 --perms, -p preserve permissions
385 --executability, -E preserve executability
386 --chmod=CHMOD affect file and/or directory permissions
387 --acls, -A preserve ACLs (implies --perms)
388 --xattrs, -X preserve extended attributes
389 --owner, -o preserve owner (super-user only)
390 --group, -g preserve group
391 --devices preserve device files (super-user only)
392 --copy-devices copy device contents as a regular file
393 --write-devices write to devices as files (implies --inplace)
394 --specials preserve special files
395 -D same as --devices --specials
396 --times, -t preserve modification times
397 --atimes, -U preserve access (use) times
398 --open-noatime avoid changing the atime on opened files
399 --crtimes, -N preserve create times (newness)
400 --omit-dir-times, -O omit directories from --times
401 --omit-link-times, -J omit symlinks from --times
402 --super receiver attempts super-user activities
403 --fake-super store/recover privileged attrs using xattrs
404 --sparse, -S turn sequences of nulls into sparse blocks
405 --preallocate allocate dest files before writing them
406 --dry-run, -n perform a trial run with no changes made
407 --whole-file, -W copy files whole (w/o delta-xfer algorithm)
408 --checksum-choice=STR choose the checksum algorithm (aka --cc)
409 --one-file-system, -x don't cross filesystem boundaries
410 --block-size=SIZE, -B force a fixed checksum block-size
411 --rsh=COMMAND, -e specify the remote shell to use
412 --rsync-path=PROGRAM specify the rsync to run on remote machine
413 --existing skip creating new files on receiver
414 --ignore-existing skip updating files that exist on receiver
415 --remove-source-files sender removes synchronized files (non-dir)
416 --del an alias for --delete-during
417 --delete delete extraneous files from dest dirs
418 --delete-before receiver deletes before xfer, not during
419 --delete-during receiver deletes during the transfer
420 --delete-delay find deletions during, delete after
421 --delete-after receiver deletes after transfer, not during
422 --delete-excluded also delete excluded files from dest dirs
423 --ignore-missing-args ignore missing source args without error
424 --delete-missing-args delete missing source args from destination
425 --ignore-errors delete even if there are I/O errors
426 --force force deletion of dirs even if not empty
427 --max-delete=NUM don't delete more than NUM files
428 --max-size=SIZE don't transfer any file larger than SIZE
429 --min-size=SIZE don't transfer any file smaller than SIZE
430 --max-alloc=SIZE change a limit relating to memory alloc
431 --partial keep partially transferred files
432 --partial-dir=DIR put a partially transferred file into DIR
433 --delay-updates put all updated files into place at end
434 --prune-empty-dirs, -m prune empty directory chains from file-list
435 --numeric-ids don't map uid/gid values by user/group name
436 --usermap=STRING custom username mapping
437 --groupmap=STRING custom groupname mapping
438 --chown=USER:GROUP simple username/groupname mapping
439 --timeout=SECONDS set I/O timeout in seconds
440 --contimeout=SECONDS set daemon connection timeout in seconds
441 --ignore-times, -I don't skip files that match size and time
442 --size-only skip files that match in size
443 --modify-window=NUM, -@ set the accuracy for mod-time comparisons
444 --temp-dir=DIR, -T create temporary files in directory DIR
445 --fuzzy, -y find similar file for basis if no dest file
446 --compare-dest=DIR also compare destination files relative to DIR
447 --copy-dest=DIR ... and include copies of unchanged files
448 --link-dest=DIR hardlink to files in DIR when unchanged
449 --compress, -z compress file data during the transfer
450 --compress-choice=STR choose the compression algorithm (aka --zc)
451 --compress-level=NUM explicitly set compression level (aka --zl)
452 --skip-compress=LIST skip compressing files with suffix in LIST
453 --cvs-exclude, -C auto-ignore files in the same way CVS does
454 --filter=RULE, -f add a file-filtering RULE
455 -F same as --filter='dir-merge /.rsync-filter'
456 repeated: --filter='- .rsync-filter'
457 --exclude=PATTERN exclude files matching PATTERN
458 --exclude-from=FILE read exclude patterns from FILE
459 --include=PATTERN don't exclude files matching PATTERN
460 --include-from=FILE read include patterns from FILE
461 --files-from=FILE read list of source-file names from FILE
462 --from0, -0 all *-from/filter files are delimited by 0s
463 --old-args disable the modern arg-protection idiom
464 --protect-args, -s no space-splitting; wildcard chars only
465 --copy-as=USER[:GROUP] specify user & optional group for the copy
466 --address=ADDRESS bind address for outgoing socket to daemon
467 --port=PORT specify double-colon alternate port number
468 --sockopts=OPTIONS specify custom TCP options
469 --blocking-io use blocking I/O for the remote shell
470 --outbuf=N|L|B set out buffering to None, Line, or Block
471 --stats give some file-transfer stats
472 --8-bit-output, -8 leave high-bit chars unescaped in output
473 --human-readable, -h output numbers in a human-readable format
474 --progress show progress during transfer
475 -P same as --partial --progress
476 --itemize-changes, -i output a change-summary for all updates
477 --remote-option=OPT, -M send OPTION to the remote side only
478 --out-format=FORMAT output updates using the specified FORMAT
479 --log-file=FILE log what we're doing to the specified FILE
480 --log-file-format=FMT log updates using the specified FMT
481 --password-file=FILE read daemon-access password from FILE
482 --early-input=FILE use FILE for daemon's early exec input
483 --list-only list the files instead of copying them
484 --bwlimit=RATE limit socket I/O bandwidth
485 --stop-after=MINS Stop rsync after MINS minutes have elapsed
486 --stop-at=y-m-dTh:m Stop rsync at the specified point in time
487 --fsync fsync every written file
488 --write-batch=FILE write a batched update to FILE
489 --only-write-batch=FILE like --write-batch but w/o updating dest
490 --read-batch=FILE read a batched update from FILE
491 --protocol=NUM force an older protocol version to be used
492 --iconv=CONVERT_SPEC request charset conversion of filenames
493 --checksum-seed=NUM set block/file checksum seed (advanced)
494 --ipv4, -4 prefer IPv4
495 --ipv6, -6 prefer IPv6
496 --version, -V print the version + other info and exit
497 --help, -h (*) show this help (* -h is help only on its own)
498
499 Rsync can also be run as a daemon, in which case the following options
500 are accepted:
501
502 --daemon run as an rsync daemon
503 --address=ADDRESS bind to the specified address
504 --bwlimit=RATE limit socket I/O bandwidth
505 --config=FILE specify alternate rsyncd.conf file
506 --dparam=OVERRIDE, -M override global daemon config parameter
507 --no-detach do not detach from the parent
508 --port=PORT listen on alternate port number
509 --log-file=FILE override the "log file" setting
510 --log-file-format=FMT override the "log format" setting
511 --sockopts=OPTIONS specify custom TCP options
512 --verbose, -v increase verbosity
513 --ipv4, -4 prefer IPv4
514 --ipv6, -6 prefer IPv6
515 --help, -h show this help (when used with --daemon)
516
518 Rsync accepts both long (double-dash + word) and short (single-dash +
519 letter) options. The full list of the available options are described
520 below. If an option can be specified in more than one way, the choices
521 are comma-separated. Some options only have a long variant, not a
522 short. If the option takes a parameter, the parameter is only listed
523 after the long variant, even though it must also be specified for the
524 short. When specifying a parameter, you can either use the form --op‐
525 tion=param or replace the '=' with whitespace. The parameter may need
526 to be quoted in some manner for it to survive the shell's command-line
527 parsing. Keep in mind that a leading tilde (~) in a filename is sub‐
528 stituted by your shell, so --option=~/foo will not change the tilde
529 into your home directory (remove the '=' for that).
530
531 --help Print a short help page describing the options available in
532 rsync and exit. You can also use -h for --help when it is used
533 without any other options (since it normally means --human-read‐
534 able).
535
536 --version, -V
537 Print the rsync version plus other info and exit.
538
539 The output includes the default list of checksum algorithms, the
540 default list of compression algorithms, a list of compiled-in
541 capabilities, a link to the rsync web site, and some li‐
542 cense/copyright info.
543
544 --verbose, -v
545 This option increases the amount of information you are given
546 during the transfer. By default, rsync works silently. A sin‐
547 gle -v will give you information about what files are being
548 transferred and a brief summary at the end. Two -v options will
549 give you information on what files are being skipped and
550 slightly more information at the end. More than two -v options
551 should only be used if you are debugging rsync.
552
553 The end-of-run summary tells you the number of bytes sent to the
554 remote rsync (which is the receiving side on a local copy), the
555 number of bytes received from the remote host, and the average
556 bytes per second of the transferred data computed over the en‐
557 tire length of the rsync run. The second line shows the total
558 size (in bytes), which is the sum of all the file sizes that
559 rsync considered transferring. It also shows a "speedup" value,
560 which is a ratio of the total file size divided by the sum of
561 the sent and received bytes (which is really just a feel-good
562 bigger-is-better number). Note that these byte values can be
563 made more (or less) human-readable by using the --human-readable
564 (or --no-human-readable) options.
565
566 In a modern rsync, the -v option is equivalent to the setting of
567 groups of --info and --debug options. You can choose to use
568 these newer options in addition to, or in place of using --ver‐
569 bose, as any fine-grained settings override the implied settings
570 of -v. Both --info and --debug have a way to ask for help that
571 tells you exactly what flags are set for each increase in ver‐
572 bosity.
573
574 However, do keep in mind that a daemon's "max verbosity" setting
575 will limit how high of a level the various individual flags can
576 be set on the daemon side. For instance, if the max is 2, then
577 any info and/or debug flag that is set to a higher value than
578 what would be set by -vv will be downgraded to the -vv level in
579 the daemon's logging.
580
581 --info=FLAGS
582 This option lets you have fine-grained control over the informa‐
583 tion output you want to see. An individual flag name may be
584 followed by a level number, with 0 meaning to silence that out‐
585 put, 1 being the default output level, and higher numbers in‐
586 creasing the output of that flag (for those that support higher
587 levels). Use --info=help to see all the available flag names,
588 what they output, and what flag names are added for each in‐
589 crease in the verbose level. Some examples:
590
591 rsync -a --info=progress2 src/ dest/
592 rsync -avv --info=stats2,misc1,flist0 src/ dest/
593
594 Note that --info=name's output is affected by the --out-format
595 and --itemize-changes (-i) options. See those options for more
596 information on what is output and when.
597
598 This option was added to 3.1.0, so an older rsync on the server
599 side might reject your attempts at fine-grained control (if one
600 or more flags needed to be send to the server and the server was
601 too old to understand them). See also the "max verbosity"
602 caveat above when dealing with a daemon.
603
604 --debug=FLAGS
605 This option lets you have fine-grained control over the debug
606 output you want to see. An individual flag name may be followed
607 by a level number, with 0 meaning to silence that output, 1 be‐
608 ing the default output level, and higher numbers increasing the
609 output of that flag (for those that support higher levels). Use
610 --debug=help to see all the available flag names, what they out‐
611 put, and what flag names are added for each increase in the ver‐
612 bose level. Some examples:
613
614 rsync -avvv --debug=none src/ dest/
615 rsync -avA --del --debug=del2,acl src/ dest/
616
617 Note that some debug messages will only be output when the
618 --stderr=all option is specified, especially those pertaining to
619 I/O and buffer debugging.
620
621 Beginning in 3.2.0, this option is no longer auto-forwarded to
622 the server side in order to allow you to specify different debug
623 values for each side of the transfer, as well as to specify a
624 new debug option that is only present in one of the rsync ver‐
625 sions. If you want to duplicate the same option on both sides,
626 using brace expansion is an easy way to save you some typing.
627 This works in zsh and bash:
628
629 rsync -aiv {-M,}--debug=del2 src/ dest/
630
631 --stderr=errors|all|client
632 This option controls which processes output to stderr and if
633 info messages are also changed to stderr. The mode strings can
634 be abbreviated, so feel free to use a single letter value. The
635 3 possible choices are:
636
637 o errors - (the default) causes all the rsync processes to
638 send an error directly to stderr, even if the process is
639 on the remote side of the transfer. Info messages are
640 sent to the client side via the protocol stream. If
641 stderr is not available (i.e. when directly connecting
642 with a daemon via a socket) errors fall back to being
643 sent via the protocol stream.
644
645 o all - causes all rsync messages (info and error) to get
646 written directly to stderr from all (possible) processes.
647 This causes stderr to become line-buffered (instead of
648 raw) and eliminates the ability to divide up the info and
649 error messages by file handle. For those doing debugging
650 or using several levels of verbosity, this option can
651 help to avoid clogging up the transfer stream (which
652 should prevent any chance of a deadlock bug hanging
653 things up). It also allows --debug to enable some extra
654 I/O related messages.
655
656 o client - causes all rsync messages to be sent to the
657 client side via the protocol stream. One client process
658 outputs all messages, with errors on stderr and info mes‐
659 sages on stdout. This was the default in older rsync
660 versions, but can cause error delays when a lot of trans‐
661 fer data is ahead of the messages. If you're pushing
662 files to an older rsync, you may want to use --stderr=all
663 since that idiom has been around for several releases.
664
665 This option was added in rsync 3.2.3. This version also began
666 the forwarding of a non-default setting to the remote side,
667 though rsync uses the backward-compatible options --msgs2stderr
668 and --no-msgs2stderr to represent the all and client settings,
669 respectively. A newer rsync will continue to accept these older
670 option names to maintain compatibility.
671
672 --quiet, -q
673 This option decreases the amount of information you are given
674 during the transfer, notably suppressing information messages
675 from the remote server. This option is useful when invoking
676 rsync from cron.
677
678 --no-motd
679 This option affects the information that is output by the client
680 at the start of a daemon transfer. This suppresses the message-
681 of-the-day (MOTD) text, but it also affects the list of modules
682 that the daemon sends in response to the "rsync host::" request
683 (due to a limitation in the rsync protocol), so omit this option
684 if you want to request the list of modules from the daemon.
685
686 --ignore-times, -I
687 Normally rsync will skip any files that are already the same
688 size and have the same modification timestamp. This option
689 turns off this "quick check" behavior, causing all files to be
690 updated.
691
692 This option can be confusing compared to --ignore-existing and
693 --ignore-non-existing in that that they cause rsync to transfer
694 fewer files, while this option causes rsync to transfer more
695 files.
696
697 --size-only
698 This modifies rsync's "quick check" algorithm for finding files
699 that need to be transferred, changing it from the default of
700 transferring files with either a changed size or a changed last-
701 modified time to just looking for files that have changed in
702 size. This is useful when starting to use rsync after using an‐
703 other mirroring system which may not preserve timestamps ex‐
704 actly.
705
706 --modify-window=NUM, -@
707 When comparing two timestamps, rsync treats the timestamps as
708 being equal if they differ by no more than the modify-window
709 value. The default is 0, which matches just integer seconds.
710 If you specify a negative value (and the receiver is at least
711 version 3.1.3) then nanoseconds will also be taken into account.
712 Specifying 1 is useful for copies to/from MS Windows FAT
713 filesystems, because FAT represents times with a 2-second reso‐
714 lution (allowing times to differ from the original by up to 1
715 second).
716
717 If you want all your transfers to default to comparing nanosec‐
718 onds, you can create a ~/.popt file and put these lines in it:
719
720 rsync alias -a -a@-1
721 rsync alias -t -t@-1
722
723 With that as the default, you'd need to specify --modify-win‐
724 dow=0 (aka -@0) to override it and ignore nanoseconds, e.g. if
725 you're copying between ext3 and ext4, or if the receiving rsync
726 is older than 3.1.3.
727
728 --checksum, -c
729 This changes the way rsync checks if the files have been changed
730 and are in need of a transfer. Without this option, rsync uses
731 a "quick check" that (by default) checks if each file's size and
732 time of last modification match between the sender and receiver.
733 This option changes this to compare a 128-bit checksum for each
734 file that has a matching size. Generating the checksums means
735 that both sides will expend a lot of disk I/O reading all the
736 data in the files in the transfer, so this can slow things down
737 significantly (and this is prior to any reading that will be
738 done to transfer changed files)
739
740 The sending side generates its checksums while it is doing the
741 file-system scan that builds the list of the available files.
742 The receiver generates its checksums when it is scanning for
743 changed files, and will checksum any file that has the same size
744 as the corresponding sender's file: files with either a changed
745 size or a changed checksum are selected for transfer.
746
747 Note that rsync always verifies that each transferred file was
748 correctly reconstructed on the receiving side by checking a
749 whole-file checksum that is generated as the file is trans‐
750 ferred, but that automatic after-the-transfer verification has
751 nothing to do with this option's before-the-transfer "Does this
752 file need to be updated?" check.
753
754 The checksum used is auto-negotiated between the client and the
755 server, but can be overridden using either the --checksum-choice
756 (--cc) option or an environment variable that is discussed in
757 that option's section.
758
759 --archive, -a
760 This is equivalent to -rlptgoD. It is a quick way of saying you
761 want recursion and want to preserve almost everything. Be aware
762 that it does not include preserving ACLs (-A), xattrs (-X),
763 atimes (-U), crtimes (-N), nor the finding and preserving of
764 hardlinks (-H).
765
766 The only exception to the above equivalence is when --files-from
767 is specified, in which case -r is not implied.
768
769 --no-OPTION
770 You may turn off one or more implied options by prefixing the
771 option name with "no-". Not all positive options have a negated
772 opposite, but a lot do, including those that can be used to dis‐
773 able an implied option (e.g. --no-D, --no-perms) or have dif‐
774 ferent defaults in various circumstances (e.g. --no-whole-file,
775 --no-blocking-io, --no-dirs). Every valid negated option ac‐
776 cepts both the short and the long option name after the "no-"
777 prefix (e.g. --no-R is the same as --no-relative).
778
779 As an example, if you want to use --archive (-a) but don't want
780 --owner (-o), instead of converting -a into -rlptgD, you can
781 specify -a --no-o (aka --archive --no-owner).
782
783 The order of the options is important: if you specify --no-r -a,
784 the -r option would end up being turned on, the opposite of
785 -a --no-r. Note also that the side-effects of the --files-from
786 option are NOT positional, as it affects the default state of
787 several options and slightly changes the meaning of -a (see the
788 --files-from option for more details).
789
790 --recursive, -r
791 This tells rsync to copy directories recursively. See also
792 --dirs (-d) for an option that allows the scanning of a single
793 directory.
794
795 See the --inc-recursive option for a discussion of the incremen‐
796 tal recursion for creating the list of files to transfer.
797
798 --inc-recursive, --i-r
799 This option explicitly enables on incremental recursion when
800 scanning for files, which is enabled by default when using the
801 --recursive option and both sides of the transfer are running
802 rsync 3.0.0 or newer.
803
804 Incremental recursion uses much less memory than non-incremen‐
805 tal, while also beginning the transfer more quickly (since it
806 doesn't need to scan the entire transfer hierarchy before it
807 starts transferring files). If no recursion is enabled in the
808 source files, this option has no effect.
809
810 Some options require rsync to know the full file list, so these
811 options disable the incremental recursion mode. These include:
812
813 o --delete-before (the old default of --delete)
814
815 o --delete-after
816
817 o --prune-empty-dirs
818
819 o --delay-updates
820
821 In order to make --delete compatible with incremental recursion,
822 rsync 3.0.0 made --delete-during the default delete mode (which
823 was first first added in 2.6.4).
824
825 One side-effect of incremental recursion is that any missing
826 sub-directories inside a recursively-scanned directory are (by
827 default) created prior to recursing into the sub-dirs. This
828 earlier creation point (compared to a non-incremental recursion)
829 allows rsync to then set the modify time of the finished direc‐
830 tory right away (without having to delay that until a bunch of
831 recursive copying has finished). However, these early directo‐
832 ries don't yet have their completed mode, mtime, or ownership
833 set -- they have more restrictive rights until the subdirec‐
834 tory's copying actually begins. This early-creation idiom can
835 be avoiding by using the --omit-dir-times option.
836
837 Incremental recursion can be disabled using the --no-inc-recur‐
838 sive (--no-i-r) option.
839
840 --no-inc-recursive, --no-i-r
841 Disables the new incremental recursion algorithm of the --recur‐
842 sive option. This makes rsync scan the full file list before it
843 begins to transfer files. See --inc-recursive for more info.
844
845 --relative, -R
846 Use relative paths. This means that the full path names speci‐
847 fied on the command line are sent to the server rather than just
848 the last parts of the filenames. This is particularly useful
849 when you want to send several different directories at the same
850 time. For example, if you used this command:
851
852 rsync -av /foo/bar/baz.c remote:/tmp/
853
854 would create a file named baz.c in /tmp/ on the remote machine.
855 If instead you used
856
857 rsync -avR /foo/bar/baz.c remote:/tmp/
858
859 then a file named /tmp/foo/bar/baz.c would be created on the re‐
860 mote machine, preserving its full path. These extra path ele‐
861 ments are called "implied directories" (i.e. the "foo" and the
862 "foo/bar" directories in the above example).
863
864 Beginning with rsync 3.0.0, rsync always sends these implied di‐
865 rectories as real directories in the file list, even if a path
866 element is really a symlink on the sending side. This prevents
867 some really unexpected behaviors when copying the full path of a
868 file that you didn't realize had a symlink in its path. If you
869 want to duplicate a server-side symlink, include both the sym‐
870 link via its path, and referent directory via its real path. If
871 you're dealing with an older rsync on the sending side, you may
872 need to use the --no-implied-dirs option.
873
874 It is also possible to limit the amount of path information that
875 is sent as implied directories for each path you specify. With
876 a modern rsync on the sending side (beginning with 2.6.7), you
877 can insert a dot and a slash into the source path, like this:
878
879 rsync -avR /foo/./bar/baz.c remote:/tmp/
880
881 That would create /tmp/bar/baz.c on the remote machine. (Note
882 that the dot must be followed by a slash, so "/foo/." would not
883 be abbreviated.) For older rsync versions, you would need to use
884 a chdir to limit the source path. For example, when pushing
885 files:
886
887 (cd /foo; rsync -avR bar/baz.c remote:/tmp/)
888
889 (Note that the parens put the two commands into a sub-shell, so
890 that the "cd" command doesn't remain in effect for future com‐
891 mands.) If you're pulling files from an older rsync, use this
892 idiom (but only for a non-daemon transfer):
893
894 rsync -avR --rsync-path="cd /foo; rsync" \
895 remote:bar/baz.c /tmp/
896
897 --no-implied-dirs
898 This option affects the default behavior of the --relative op‐
899 tion. When it is specified, the attributes of the implied di‐
900 rectories from the source names are not included in the trans‐
901 fer. This means that the corresponding path elements on the
902 destination system are left unchanged if they exist, and any
903 missing implied directories are created with default attributes.
904 This even allows these implied path elements to have big differ‐
905 ences, such as being a symlink to a directory on the receiving
906 side.
907
908 For instance, if a command-line arg or a files-from entry told
909 rsync to transfer the file "path/foo/file", the directories
910 "path" and "path/foo" are implied when --relative is used. If
911 "path/foo" is a symlink to "bar" on the destination system, the
912 receiving rsync would ordinarily delete "path/foo", recreate it
913 as a directory, and receive the file into the new directory.
914 With --no-implied-dirs, the receiving rsync updates
915 "path/foo/file" using the existing path elements, which means
916 that the file ends up being created in "path/bar". Another way
917 to accomplish this link preservation is to use the --keep-
918 dirlinks option (which will also affect symlinks to directories
919 in the rest of the transfer).
920
921 When pulling files from an rsync older than 3.0.0, you may need
922 to use this option if the sending side has a symlink in the path
923 you request and you wish the implied directories to be trans‐
924 ferred as normal directories.
925
926 --backup, -b
927 With this option, preexisting destination files are renamed as
928 each file is transferred or deleted. You can control where the
929 backup file goes and what (if any) suffix gets appended using
930 the --backup-dir and --suffix options.
931
932 If you don't specify --backup-dir:
933
934 1. the --omit-dir-times option will be forced on
935
936 2. the use of --delete (without --delete-excluded), causes
937 rsync to add a "protect" filter-rule for the backup suf‐
938 fix to the end of all your existing filters that looks
939 like this: -f "P *~". This rule prevents previously
940 backed-up files from being deleted.
941
942 Note that if you are supplying your own filter rules, you may
943 need to manually insert your own exclude/protect rule somewhere
944 higher up in the list so that it has a high enough priority to
945 be effective (e.g. if your rules specify a trailing inclu‐
946 sion/exclusion of *, the auto-added rule would never be
947 reached).
948
949 --backup-dir=DIR
950 This implies the --backup option, and tells rsync to store all
951 backups in the specified directory on the receiving side. This
952 can be used for incremental backups. You can additionally spec‐
953 ify a backup suffix using the --suffix option (otherwise the
954 files backed up in the specified directory will keep their orig‐
955 inal filenames).
956
957 Note that if you specify a relative path, the backup directory
958 will be relative to the destination directory, so you probably
959 want to specify either an absolute path or a path that starts
960 with "../". If an rsync daemon is the receiver, the backup dir
961 cannot go outside the module's path hierarchy, so take extra
962 care not to delete it or copy into it.
963
964 --suffix=SUFFIX
965 This option allows you to override the default backup suffix
966 used with the --backup (-b) option. The default suffix is a ~
967 if no --backup-dir was specified, otherwise it is an empty
968 string.
969
970 --update, -u
971 This forces rsync to skip any files which exist on the destina‐
972 tion and have a modified time that is newer than the source
973 file. (If an existing destination file has a modification time
974 equal to the source file's, it will be updated if the sizes are
975 different.)
976
977 Note that this does not affect the copying of dirs, symlinks, or
978 other special files. Also, a difference of file format between
979 the sender and receiver is always considered to be important
980 enough for an update, no matter what date is on the objects. In
981 other words, if the source has a directory where the destination
982 has a file, the transfer would occur regardless of the time‐
983 stamps.
984
985 This option is a transfer rule, not an exclude, so it doesn't
986 affect the data that goes into the file-lists, and thus it
987 doesn't affect deletions. It just limits the files that the re‐
988 ceiver requests to be transferred.
989
990 A caution for those that choose to combine --inplace with --up‐
991 date: an interrupted transfer will leave behind a partial file
992 on the receiving side that has a very recent modified time, so
993 re-running the transfer will probably not continue the inter‐
994 rupted file. As such, it is usually best to avoid combining
995 this with --inplace unless you have implemented manual steps to
996 handle any interrupted in-progress files.
997
998 --inplace
999 This option changes how rsync transfers a file when its data
1000 needs to be updated: instead of the default method of creating a
1001 new copy of the file and moving it into place when it is com‐
1002 plete, rsync instead writes the updated data directly to the
1003 destination file.
1004
1005 This has several effects:
1006
1007 o Hard links are not broken. This means the new data will
1008 be visible through other hard links to the destination
1009 file. Moreover, attempts to copy differing source files
1010 onto a multiply-linked destination file will result in a
1011 "tug of war" with the destination data changing back and
1012 forth.
1013
1014 o In-use binaries cannot be updated (either the OS will
1015 prevent this from happening, or binaries that attempt to
1016 swap-in their data will misbehave or crash).
1017
1018 o The file's data will be in an inconsistent state during
1019 the transfer and will be left that way if the transfer is
1020 interrupted or if an update fails.
1021
1022 o A file that rsync cannot write to cannot be updated.
1023 While a super user can update any file, a normal user
1024 needs to be granted write permission for the open of the
1025 file for writing to be successful.
1026
1027 o The efficiency of rsync's delta-transfer algorithm may be
1028 reduced if some data in the destination file is overwrit‐
1029 ten before it can be copied to a position later in the
1030 file. This does not apply if you use --backup, since
1031 rsync is smart enough to use the backup file as the basis
1032 file for the transfer.
1033
1034 WARNING: you should not use this option to update files that are
1035 being accessed by others, so be careful when choosing to use
1036 this for a copy.
1037
1038 This option is useful for transferring large files with block-
1039 based changes or appended data, and also on systems that are
1040 disk bound, not network bound. It can also help keep a copy-on-
1041 write filesystem snapshot from diverging the entire contents of
1042 a file that only has minor changes.
1043
1044 The option implies --partial (since an interrupted transfer does
1045 not delete the file), but conflicts with --partial-dir and --de‐
1046 lay-updates. Prior to rsync 2.6.4 --inplace was also incompati‐
1047 ble with --compare-dest and --link-dest.
1048
1049 --append
1050 This special copy mode only works to efficiently update files
1051 that are known to be growing larger where any existing content
1052 on the receiving side is also known to be the same as the con‐
1053 tent on the sender. The use of --append can be dangerous if you
1054 aren't 100% sure that all the files in the transfer are shared,
1055 growing files. You should thus use filter rules to ensure that
1056 you weed out any files that do not fit this criteria.
1057
1058 Rsync updates these growing file in-place without verifying any
1059 of the existing content in the file (it only verifies the con‐
1060 tent that it is appending). Rsync skips any files that exist on
1061 the receiving side that are not shorter than the associated file
1062 on the sending side (which means that new files are trans‐
1063 ferred). It also skips any files whose size on the sending side
1064 gets shorter during the send negotiations (rsync warns about a
1065 "diminished" file when this happens).
1066
1067 This does not interfere with the updating of a file's non-con‐
1068 tent attributes (e.g. permissions, ownership, etc.) when the
1069 file does not need to be transferred, nor does it affect the up‐
1070 dating of any directories or non-regular files.
1071
1072 --append-verify
1073 This special copy mode works like --append except that all the
1074 data in the file is included in the checksum verification (mak‐
1075 ing it less efficient but also potentially safer). This option
1076 can be dangerous if you aren't 100% sure that all the files in
1077 the transfer are shared, growing files. See the --append option
1078 for more details.
1079
1080 Note: prior to rsync 3.0.0, the --append option worked like
1081 --append-verify, so if you are interacting with an older rsync
1082 (or the transfer is using a protocol prior to 30), specifying
1083 either append option will initiate an --append-verify transfer.
1084
1085 --dirs, -d
1086 Tell the sending side to include any directories that are en‐
1087 countered. Unlike --recursive, a directory's contents are not
1088 copied unless the directory name specified is "." or ends with a
1089 trailing slash (e.g. ".", "dir/.", "dir/", etc.). Without this
1090 option or the --recursive option, rsync will skip all directo‐
1091 ries it encounters (and output a message to that effect for each
1092 one). If you specify both --dirs and --recursive, --recursive
1093 takes precedence.
1094
1095 The --dirs option is implied by the --files-from option or the
1096 --list-only option (including an implied --list-only usage) if
1097 --recursive wasn't specified (so that directories are seen in
1098 the listing). Specify --no-dirs (or --no-d) if you want to turn
1099 this off.
1100
1101 There is also a backward-compatibility helper option, --old-dirs
1102 (--old-d) that tells rsync to use a hack of -r --exclude='/*/*'
1103 to get an older rsync to list a single directory without recurs‐
1104 ing.
1105
1106 --mkpath
1107 Create a missing path component of the destination arg. This
1108 allows rsync to create multiple levels of missing destination
1109 dirs and to create a path in which to put a single renamed file.
1110 Keep in mind that you'll need to supply a trailing slash if you
1111 want the entire destination path to be treated as a directory
1112 when copying a single arg (making rsync behave the same way that
1113 it would if the path component of the destination had already
1114 existed).
1115
1116 For example, the following creates a copy of file foo as bar in
1117 the sub/dir directory, creating dirs "sub" and "sub/dir" if ei‐
1118 ther do not yet exist:
1119
1120 rsync -ai --mkpath foo sub/dir/bar
1121
1122 If you instead ran the following, it would have created file foo
1123 in the sub/dir/bar directory:
1124
1125 rsync -ai --mkpath foo sub/dir/bar/
1126
1127 --links, -l
1128 Add symlinks to the transferred files instead of noisily ignor‐
1129 ing them with a "non-regular file" warning for each symlink en‐
1130 countered. You can alternately silence the warning by specify‐
1131 ing --info=nonreg0.
1132
1133 The default handling of symlinks is to recreate each symlink's
1134 unchanged value on the receiving side.
1135
1136 See the SYMBOLIC LINKS section for multi-option info.
1137
1138 --copy-links, -L
1139 The sender transforms each symlink encountered in the transfer
1140 into the referent item, following the symlink chain to the file
1141 or directory that it references. If a symlink chain is broken,
1142 an error is output and the file is dropped from the transfer.
1143
1144 This option supersedes any other options that affect symlinks in
1145 the transfer, since there are no symlinks left in the transfer.
1146
1147 This option does not change the handling of existing symlinks on
1148 the receiving side, unlike versions of rsync prior to 2.6.3
1149 which had the side-effect of telling the receiving side to also
1150 follow symlinks. A modern rsync won't forward this option to a
1151 remote receiver (since only the sender needs to know about it),
1152 so this caveat should only affect someone using an rsync client
1153 older than 2.6.7 (which is when -L stopped being forwarded to
1154 the receiver).
1155
1156 See the --keep-dirlinks (-K) if you need a symlink to a direc‐
1157 tory to be treated as a real directory on the receiving side.
1158
1159 See the SYMBOLIC LINKS section for multi-option info.
1160
1161 --copy-unsafe-links
1162 This tells rsync to copy the referent of symbolic links that
1163 point outside the copied tree. Absolute symlinks are also
1164 treated like ordinary files, and so are any symlinks in the
1165 source path itself when --relative is used.
1166
1167 Note that the cut-off point is the top of the transfer, which is
1168 the part of the path that rsync isn't mentioning in the verbose
1169 output. If you copy "/src/subdir" to "/dest/" then the "subdir"
1170 directory is a name inside the transfer tree, not the top of the
1171 transfer (which is /src) so it is legal for created relative
1172 symlinks to refer to other names inside the /src and /dest di‐
1173 rectories. If you instead copy "/src/subdir/" (with a trailing
1174 slash) to "/dest/subdir" that would not allow symlinks to any
1175 files outside of "subdir".
1176
1177 Note that safe symlinks are only copied if --links was also
1178 specified or implied. The --copy-unsafe-links option has no ex‐
1179 tra effect when combined with --copy-links.
1180
1181 See the SYMBOLIC LINKS section for multi-option info.
1182
1183 --safe-links
1184 This tells the receiving rsync to ignore any symbolic links in
1185 the transfer which point outside the copied tree. All absolute
1186 symlinks are also ignored.
1187
1188 Since this ignoring is happening on the receiving side, it will
1189 still be effective even when the sending side has munged sym‐
1190 links (when it is using --munge-links). It also affects dele‐
1191 tions, since the file being present in the transfer prevents any
1192 matching file on the receiver from being deleted when the sym‐
1193 link is deemed to be unsafe and is skipped.
1194
1195 This option must be combined with --links (or --archive) to have
1196 any symlinks in the transfer to conditionally ignore. Its effect
1197 is superseded by --copy-unsafe-links.
1198
1199 Using this option in conjunction with --relative may give unex‐
1200 pected results.
1201
1202 See the SYMBOLIC LINKS section for multi-option info.
1203
1204 --munge-links
1205 This option affects just one side of the transfer and tells
1206 rsync to munge symlink values when it is receiving files or un‐
1207 munge symlink values when it is sending files. The munged val‐
1208 ues make the symlinks unusable on disk but allows the original
1209 contents of the symlinks to be recovered.
1210
1211 The server-side rsync often enables this option without the
1212 client's knowledge, such as in an rsync daemon's configuration
1213 file or by an option given to the rrsync (restricted rsync)
1214 script. When specified on the client side, specify the option
1215 normally if it is the client side that has/needs the munged sym‐
1216 links, or use -M--munge-links to give the option to the server
1217 when it has/needs the munged symlinks. Note that on a local
1218 transfer, the client is the sender, so specifying the option di‐
1219 rectly unmunges symlinks while specifying it as a remote option
1220 munges symlinks.
1221
1222 This option has no affect when sent to a daemon via --remote-op‐
1223 tion because the daemon configures whether it wants munged sym‐
1224 links via its "munge symlinks" parameter.
1225
1226 The symlink value is munged/unmunged once it is in the transfer,
1227 so any option that transforms symlinks into non-symlinks occurs
1228 prior to the munging/unmunging except for --safe-links, which is
1229 a choice that the receiver makes, so it bases its decision on
1230 the munged/unmunged value. This does mean that if a receiver
1231 has munging enabled, that using --safe-links will cause all sym‐
1232 links to be ignored (since they are all absolute).
1233
1234 The method that rsync uses to munge the symlinks is to prefix
1235 each one's value with the string "/rsyncd-munged/". This pre‐
1236 vents the links from being used as long as the directory does
1237 not exist. When this option is enabled, rsync will refuse to
1238 run if that path is a directory or a symlink to a directory
1239 (though it only checks at startup). See also the "munge-sym‐
1240 links" python script in the support directory of the source code
1241 for a way to munge/unmunge one or more symlinks in-place.
1242
1243 --copy-dirlinks, -k
1244 This option causes the sending side to treat a symlink to a di‐
1245 rectory as though it were a real directory. This is useful if
1246 you don't want symlinks to non-directories to be affected, as
1247 they would be using --copy-links.
1248
1249 Without this option, if the sending side has replaced a direc‐
1250 tory with a symlink to a directory, the receiving side will
1251 delete anything that is in the way of the new symlink, including
1252 a directory hierarchy (as long as --force or --delete is in ef‐
1253 fect).
1254
1255 See also --keep-dirlinks for an analogous option for the receiv‐
1256 ing side.
1257
1258 --copy-dirlinks applies to all symlinks to directories in the
1259 source. If you want to follow only a few specified symlinks, a
1260 trick you can use is to pass them as additional source args with
1261 a trailing slash, using --relative to make the paths match up
1262 right. For example:
1263
1264 rsync -r --relative src/./ src/./follow-me/ dest/
1265
1266 This works because rsync calls lstat(2) on the source arg as
1267 given, and the trailing slash makes lstat(2) follow the symlink,
1268 giving rise to a directory in the file-list which overrides the
1269 symlink found during the scan of "src/./".
1270
1271 See the SYMBOLIC LINKS section for multi-option info.
1272
1273 --keep-dirlinks, -K
1274 This option causes the receiving side to treat a symlink to a
1275 directory as though it were a real directory, but only if it
1276 matches a real directory from the sender. Without this option,
1277 the receiver's symlink would be deleted and replaced with a real
1278 directory.
1279
1280 For example, suppose you transfer a directory "foo" that con‐
1281 tains a file "file", but "foo" is a symlink to directory "bar"
1282 on the receiver. Without --keep-dirlinks, the receiver deletes
1283 symlink "foo", recreates it as a directory, and receives the
1284 file into the new directory. With --keep-dirlinks, the receiver
1285 keeps the symlink and "file" ends up in "bar".
1286
1287 One note of caution: if you use --keep-dirlinks, you must trust
1288 all the symlinks in the copy or enable the --munge-links option
1289 on the receiving side! If it is possible for an untrusted user
1290 to create their own symlink to any real directory, the user
1291 could then (on a subsequent copy) replace the symlink with a
1292 real directory and affect the content of whatever directory the
1293 symlink references. For backup copies, you are better off using
1294 something like a bind mount instead of a symlink to modify your
1295 receiving hierarchy.
1296
1297 See also --copy-dirlinks for an analogous option for the sending
1298 side.
1299
1300 See the SYMBOLIC LINKS section for multi-option info.
1301
1302 --hard-links, -H
1303 This tells rsync to look for hard-linked files in the source and
1304 link together the corresponding files on the destination. With‐
1305 out this option, hard-linked files in the source are treated as
1306 though they were separate files.
1307
1308 This option does NOT necessarily ensure that the pattern of hard
1309 links on the destination exactly matches that on the source.
1310 Cases in which the destination may end up with extra hard links
1311 include the following:
1312
1313 o If the destination contains extraneous hard-links (more
1314 linking than what is present in the source file list),
1315 the copying algorithm will not break them explicitly.
1316 However, if one or more of the paths have content differ‐
1317 ences, the normal file-update process will break those
1318 extra links (unless you are using the --inplace option).
1319
1320 o If you specify a --link-dest directory that contains hard
1321 links, the linking of the destination files against the
1322 --link-dest files can cause some paths in the destination
1323 to become linked together due to the --link-dest associa‐
1324 tions.
1325
1326 Note that rsync can only detect hard links between files that
1327 are inside the transfer set. If rsync updates a file that has
1328 extra hard-link connections to files outside the transfer, that
1329 linkage will be broken. If you are tempted to use the --inplace
1330 option to avoid this breakage, be very careful that you know how
1331 your files are being updated so that you are certain that no un‐
1332 intended changes happen due to lingering hard links (and see the
1333 --inplace option for more caveats).
1334
1335 If incremental recursion is active (see --inc-recursive), rsync
1336 may transfer a missing hard-linked file before it finds that an‐
1337 other link for that contents exists elsewhere in the hierarchy.
1338 This does not affect the accuracy of the transfer (i.e. which
1339 files are hard-linked together), just its efficiency (i.e. copy‐
1340 ing the data for a new, early copy of a hard-linked file that
1341 could have been found later in the transfer in another member of
1342 the hard-linked set of files). One way to avoid this ineffi‐
1343 ciency is to disable incremental recursion using the --no-inc-
1344 recursive option.
1345
1346 --perms, -p
1347 This option causes the receiving rsync to set the destination
1348 permissions to be the same as the source permissions. (See also
1349 the --chmod option for a way to modify what rsync considers to
1350 be the source permissions.)
1351
1352 When this option is off, permissions are set as follows:
1353
1354 o Existing files (including updated files) retain their ex‐
1355 isting permissions, though the --executability option
1356 might change just the execute permission for the file.
1357
1358 o New files get their "normal" permission bits set to the
1359 source file's permissions masked with the receiving di‐
1360 rectory's default permissions (either the receiving
1361 process's umask, or the permissions specified via the
1362 destination directory's default ACL), and their special
1363 permission bits disabled except in the case where a new
1364 directory inherits a setgid bit from its parent direc‐
1365 tory.
1366
1367 Thus, when --perms and --executability are both disabled,
1368 rsync's behavior is the same as that of other file-copy utili‐
1369 ties, such as cp(1) and tar(1).
1370
1371 In summary: to give destination files (both old and new) the
1372 source permissions, use --perms. To give new files the destina‐
1373 tion-default permissions (while leaving existing files un‐
1374 changed), make sure that the --perms option is off and use
1375 --chmod=ugo=rwX (which ensures that all non-masked bits get en‐
1376 abled). If you'd care to make this latter behavior easier to
1377 type, you could define a popt alias for it, such as putting this
1378 line in the file ~/.popt (the following defines the -Z option,
1379 and includes --no-g to use the default group of the destination
1380 dir):
1381
1382 rsync alias -Z --no-p --no-g --chmod=ugo=rwX
1383
1384 You could then use this new option in a command such as this
1385 one:
1386
1387 rsync -avZ src/ dest/
1388
1389 (Caveat: make sure that -a does not follow -Z, or it will re-en‐
1390 able the two --no-* options mentioned above.)
1391
1392 The preservation of the destination's setgid bit on newly-cre‐
1393 ated directories when --perms is off was added in rsync 2.6.7.
1394 Older rsync versions erroneously preserved the three special
1395 permission bits for newly-created files when --perms was off,
1396 while overriding the destination's setgid bit setting on a
1397 newly-created directory. Default ACL observance was added to
1398 the ACL patch for rsync 2.6.7, so older (or non-ACL-enabled)
1399 rsyncs use the umask even if default ACLs are present. (Keep in
1400 mind that it is the version of the receiving rsync that affects
1401 these behaviors.)
1402
1403 --executability, -E
1404 This option causes rsync to preserve the executability (or non-
1405 executability) of regular files when --perms is not enabled. A
1406 regular file is considered to be executable if at least one 'x'
1407 is turned on in its permissions. When an existing destination
1408 file's executability differs from that of the corresponding
1409 source file, rsync modifies the destination file's permissions
1410 as follows:
1411
1412 o To make a file non-executable, rsync turns off all its
1413 'x' permissions.
1414
1415 o To make a file executable, rsync turns on each 'x' per‐
1416 mission that has a corresponding 'r' permission enabled.
1417
1418 If --perms is enabled, this option is ignored.
1419
1420 --acls, -A
1421 This option causes rsync to update the destination ACLs to be
1422 the same as the source ACLs. The option also implies --perms.
1423
1424 The source and destination systems must have compatible ACL en‐
1425 tries for this option to work properly. See the --fake-super
1426 option for a way to backup and restore ACLs that are not compat‐
1427 ible.
1428
1429 --xattrs, -X
1430 This option causes rsync to update the destination extended at‐
1431 tributes to be the same as the source ones.
1432
1433 For systems that support extended-attribute namespaces, a copy
1434 being done by a super-user copies all namespaces except sys‐
1435 tem.*. A normal user only copies the user.* namespace. To be
1436 able to backup and restore non-user namespaces as a normal user,
1437 see the --fake-super option.
1438
1439 The above name filtering can be overridden by using one or more
1440 filter options with the x modifier. When you specify an xattr-
1441 affecting filter rule, rsync requires that you do your own sys‐
1442 tem/user filtering, as well as any additional filtering for what
1443 xattr names are copied and what names are allowed to be deleted.
1444 For example, to skip the system namespace, you could specify:
1445
1446 --filter='-x system.*'
1447
1448 To skip all namespaces except the user namespace, you could
1449 specify a negated-user match:
1450
1451 --filter='-x! user.*'
1452
1453 To prevent any attributes from being deleted, you could specify
1454 a receiver-only rule that excludes all names:
1455
1456 --filter='-xr *'
1457
1458 Note that the -X option does not copy rsync's special xattr val‐
1459 ues (e.g. those used by --fake-super) unless you repeat the op‐
1460 tion (e.g. -XX). This "copy all xattrs" mode cannot be used
1461 with --fake-super.
1462
1463 --chmod=CHMOD
1464 This option tells rsync to apply one or more comma-separated
1465 "chmod" modes to the permission of the files in the transfer.
1466 The resulting value is treated as though it were the permissions
1467 that the sending side supplied for the file, which means that
1468 this option can seem to have no effect on existing files if
1469 --perms is not enabled.
1470
1471 In addition to the normal parsing rules specified in the
1472 chmod(1) manpage, you can specify an item that should only apply
1473 to a directory by prefixing it with a 'D', or specify an item
1474 that should only apply to a file by prefixing it with a 'F'.
1475 For example, the following will ensure that all directories get
1476 marked set-gid, that no files are other-writable, that both are
1477 user-writable and group-writable, and that both have consistent
1478 executability across all bits:
1479
1480 --chmod=Dg+s,ug+w,Fo-w,+X
1481
1482 Using octal mode numbers is also allowed:
1483
1484 --chmod=D2775,F664
1485
1486 It is also legal to specify multiple --chmod options, as each
1487 additional option is just appended to the list of changes to
1488 make.
1489
1490 See the --perms and --executability options for how the result‐
1491 ing permission value can be applied to the files in the trans‐
1492 fer.
1493
1494 --owner, -o
1495 This option causes rsync to set the owner of the destination
1496 file to be the same as the source file, but only if the receiv‐
1497 ing rsync is being run as the super-user (see also the --super
1498 and --fake-super options). Without this option, the owner of
1499 new and/or transferred files are set to the invoking user on the
1500 receiving side.
1501
1502 The preservation of ownership will associate matching names by
1503 default, but may fall back to using the ID number in some cir‐
1504 cumstances (see also the --numeric-ids option for a full discus‐
1505 sion).
1506
1507 --group, -g
1508 This option causes rsync to set the group of the destination
1509 file to be the same as the source file. If the receiving pro‐
1510 gram is not running as the super-user (or if --no-super was
1511 specified), only groups that the invoking user on the receiving
1512 side is a member of will be preserved. Without this option, the
1513 group is set to the default group of the invoking user on the
1514 receiving side.
1515
1516 The preservation of group information will associate matching
1517 names by default, but may fall back to using the ID number in
1518 some circumstances (see also the --numeric-ids option for a full
1519 discussion).
1520
1521 --devices
1522 This option causes rsync to transfer character and block device
1523 files to the remote system to recreate these devices. If the
1524 receiving rsync is not being run as the super-user, rsync
1525 silently skips creating the device files (see also the --super
1526 and --fake-super options).
1527
1528 By default, rsync generates a "non-regular file" warning for
1529 each device file encountered when this option is not set. You
1530 can silence the warning by specifying --info=nonreg0.
1531
1532 --specials
1533 This option causes rsync to transfer special files, such as
1534 named sockets and fifos. If the receiving rsync is not being
1535 run as the super-user, rsync silently skips creating the special
1536 files (see also the --super and --fake-super options).
1537
1538 By default, rsync generates a "non-regular file" warning for
1539 each special file encountered when this option is not set. You
1540 can silence the warning by specifying --info=nonreg0.
1541
1542 -D The -D option is equivalent to "--devices --specials".
1543
1544 --copy-devices
1545 This tells rsync to treat a device on the sending side as a reg‐
1546 ular file, allowing it to be copied to a normal destination file
1547 (or another device if --write-devices was also specifed).
1548
1549 This option is refused by default by an rsync daemon.
1550
1551 --write-devices
1552 This tells rsync to treat a device on the receiving side as a
1553 regular file, allowing the writing of file data into a device.
1554
1555 This option implies the --inplace option.
1556
1557 Be careful using this, as you should know what devices are
1558 present on the receiving side of the transfer, especially when
1559 running rsync as root.
1560
1561 This option is refused by default by an rsync daemon.
1562
1563 --times, -t
1564 This tells rsync to transfer modification times along with the
1565 files and update them on the remote system. Note that if this
1566 option is not used, the optimization that excludes files that
1567 have not been modified cannot be effective; in other words, a
1568 missing -t (or -a) will cause the next transfer to behave as if
1569 it used --ignore-times (-I), causing all files to be updated
1570 (though rsync's delta-transfer algorithm will make the update
1571 fairly efficient if the files haven't actually changed, you're
1572 much better off using -t).
1573
1574 --atimes, -U
1575 This tells rsync to set the access (use) times of the destina‐
1576 tion files to the same value as the source files.
1577
1578 If repeated, it also sets the --open-noatime option, which can
1579 help you to make the sending and receiving systems have the same
1580 access times on the transferred files without needing to run
1581 rsync an extra time after a file is transferred.
1582
1583 Note that some older rsync versions (prior to 3.2.0) may have
1584 been built with a pre-release --atimes patch that does not imply
1585 --open-noatime when this option is repeated.
1586
1587 --open-noatime
1588 This tells rsync to open files with the O_NOATIME flag (on sys‐
1589 tems that support it) to avoid changing the access time of the
1590 files that are being transferred. If your OS does not support
1591 the O_NOATIME flag then rsync will silently ignore this option.
1592 Note also that some filesystems are mounted to avoid updating
1593 the atime on read access even without the O_NOATIME flag being
1594 set.
1595
1596 --crtimes, -N,
1597 This tells rsync to set the create times (newness) of the desti‐
1598 nation files to the same value as the source files.
1599
1600 --omit-dir-times, -O
1601 This tells rsync to omit directories when it is preserving modi‐
1602 fication, access, and create times. If NFS is sharing the di‐
1603 rectories on the receiving side, it is a good idea to use -O.
1604 This option is inferred if you use --backup without --backup-
1605 dir.
1606
1607 This option also has the side-effect of avoiding early creation
1608 of missing sub-directories when incremental recursion is en‐
1609 abled, as discussed in the --inc-recursive section.
1610
1611 --omit-link-times, -J
1612 This tells rsync to omit symlinks when it is preserving modifi‐
1613 cation, access, and create times.
1614
1615 --super
1616 This tells the receiving side to attempt super-user activities
1617 even if the receiving rsync wasn't run by the super-user. These
1618 activities include: preserving users via the --owner option,
1619 preserving all groups (not just the current user's groups) via
1620 the --group option, and copying devices via the --devices op‐
1621 tion. This is useful for systems that allow such activities
1622 without being the super-user, and also for ensuring that you
1623 will get errors if the receiving side isn't being run as the su‐
1624 per-user. To turn off super-user activities, the super-user can
1625 use --no-super.
1626
1627 --fake-super
1628 When this option is enabled, rsync simulates super-user activi‐
1629 ties by saving/restoring the privileged attributes via special
1630 extended attributes that are attached to each file (as needed).
1631 This includes the file's owner and group (if it is not the de‐
1632 fault), the file's device info (device & special files are cre‐
1633 ated as empty text files), and any permission bits that we won't
1634 allow to be set on the real file (e.g. the real file gets u-s,g-
1635 s,o-t for safety) or that would limit the owner's access (since
1636 the real super-user can always access/change a file, the files
1637 we create can always be accessed/changed by the creating user).
1638 This option also handles ACLs (if --acls was specified) and non-
1639 user extended attributes (if --xattrs was specified).
1640
1641 This is a good way to backup data without using a super-user,
1642 and to store ACLs from incompatible systems.
1643
1644 The --fake-super option only affects the side where the option
1645 is used. To affect the remote side of a remote-shell connec‐
1646 tion, use the --remote-option (-M) option:
1647
1648 rsync -av -M--fake-super /src/ host:/dest/
1649
1650 For a local copy, this option affects both the source and the
1651 destination. If you wish a local copy to enable this option
1652 just for the destination files, specify -M--fake-super. If you
1653 wish a local copy to enable this option just for the source
1654 files, combine --fake-super with -M--super.
1655
1656 This option is overridden by both --super and --no-super.
1657
1658 See also the fake super setting in the daemon's rsyncd.conf
1659 file.
1660
1661 --sparse, -S
1662 Try to handle sparse files efficiently so they take up less
1663 space on the destination. If combined with --inplace the file
1664 created might not end up with sparse blocks with some combina‐
1665 tions of kernel version and/or filesystem type. If --whole-file
1666 is in effect (e.g. for a local copy) then it will always work
1667 because rsync truncates the file prior to writing out the up‐
1668 dated version.
1669
1670 Note that versions of rsync older than 3.1.3 will reject the
1671 combination of --sparse and --inplace.
1672
1673 --preallocate
1674 This tells the receiver to allocate each destination file to its
1675 eventual size before writing data to the file. Rsync will only
1676 use the real filesystem-level preallocation support provided by
1677 Linux's fallocate(2) system call or Cygwin's posix_fallocate(3),
1678 not the slow glibc implementation that writes a null byte into
1679 each block.
1680
1681 Without this option, larger files may not be entirely contiguous
1682 on the filesystem, but with this option rsync will probably copy
1683 more slowly. If the destination is not an extent-supporting
1684 filesystem (such as ext4, xfs, NTFS, etc.), this option may have
1685 no positive effect at all.
1686
1687 If combined with --sparse, the file will only have sparse blocks
1688 (as opposed to allocated sequences of null bytes) if the kernel
1689 version and filesystem type support creating holes in the allo‐
1690 cated data.
1691
1692 --dry-run, -n
1693 This makes rsync perform a trial run that doesn't make any
1694 changes (and produces mostly the same output as a real run). It
1695 is most commonly used in combination with the --verbose (-v)
1696 and/or --itemize-changes (-i) options to see what an rsync com‐
1697 mand is going to do before one actually runs it.
1698
1699 The output of --itemize-changes is supposed to be exactly the
1700 same on a dry run and a subsequent real run (barring intentional
1701 trickery and system call failures); if it isn't, that's a bug.
1702 Other output should be mostly unchanged, but may differ in some
1703 areas. Notably, a dry run does not send the actual data for
1704 file transfers, so --progress has no effect, the "bytes sent",
1705 "bytes received", "literal data", and "matched data" statistics
1706 are too small, and the "speedup" value is equivalent to a run
1707 where no file transfers were needed.
1708
1709 --whole-file, -W
1710 This option disables rsync's delta-transfer algorithm, which
1711 causes all transferred files to be sent whole. The transfer may
1712 be faster if this option is used when the bandwidth between the
1713 source and destination machines is higher than the bandwidth to
1714 disk (especially when the "disk" is actually a networked
1715 filesystem). This is the default when both the source and des‐
1716 tination are specified as local paths, but only if no batch-
1717 writing option is in effect.
1718
1719 --no-whole-file, --no-W
1720 Disable whole-file updating when it is enabled by default for a
1721 local transfer. This usually slows rsync down, but it can be
1722 useful if you are trying to minimize the writes to the destina‐
1723 tion file (if combined with --inplace) or for testing the check‐
1724 sum-based update algorithm.
1725
1726 See also the --whole-file option.
1727
1728 --checksum-choice=STR, --cc=STR
1729 This option overrides the checksum algorithms. If one algorithm
1730 name is specified, it is used for both the transfer checksums
1731 and (assuming --checksum is specified) the pre-transfer check‐
1732 sums. If two comma-separated names are supplied, the first name
1733 affects the transfer checksums, and the second name affects the
1734 pre-transfer checksums (-c).
1735
1736 The checksum options that you may be able to use are:
1737
1738 o auto (the default automatic choice)
1739
1740 o xxh128
1741
1742 o xxh3
1743
1744 o xxh64 (aka xxhash)
1745
1746 o md5
1747
1748 o md4
1749
1750 o none
1751
1752 Run rsync --version to see the default checksum list compiled
1753 into your version (which may differ from the list above).
1754
1755 If "none" is specified for the first (or only) name, the
1756 --whole-file option is forced on and no checksum verification is
1757 performed on the transferred data. If "none" is specified for
1758 the second (or only) name, the --checksum option cannot be used.
1759
1760 The "auto" option is the default, where rsync bases its algo‐
1761 rithm choice on a negotiation between the client and the server
1762 as follows:
1763
1764 When both sides of the transfer are at least 3.2.0, rsync
1765 chooses the first algorithm in the client's list of choices that
1766 is also in the server's list of choices. If no common checksum
1767 choice is found, rsync exits with an error. If the remote rsync
1768 is too old to support checksum negotiation, a value is chosen
1769 based on the protocol version (which chooses between MD5 and
1770 various flavors of MD4 based on protocol age).
1771
1772 The default order can be customized by setting the environment
1773 variable RSYNC_CHECKSUM_LIST to a space-separated list of ac‐
1774 ceptable checksum names. If the string contains a "&" charac‐
1775 ter, it is separated into the "client string & server string",
1776 otherwise the same string applies to both. If the string (or
1777 string portion) contains no non-whitespace characters, the de‐
1778 fault checksum list is used. This method does not allow you to
1779 specify the transfer checksum separately from the pre-transfer
1780 checksum, and it discards "auto" and all unknown checksum names.
1781 A list with only invalid names results in a failed negotiation.
1782
1783 The use of the --checksum-choice option overrides this environ‐
1784 ment list.
1785
1786 --one-file-system, -x
1787 This tells rsync to avoid crossing a filesystem boundary when
1788 recursing. This does not limit the user's ability to specify
1789 items to copy from multiple filesystems, just rsync's recursion
1790 through the hierarchy of each directory that the user specified,
1791 and also the analogous recursion on the receiving side during
1792 deletion. Also keep in mind that rsync treats a "bind" mount to
1793 the same device as being on the same filesystem.
1794
1795 If this option is repeated, rsync omits all mount-point directo‐
1796 ries from the copy. Otherwise, it includes an empty directory
1797 at each mount-point it encounters (using the attributes of the
1798 mounted directory because those of the underlying mount-point
1799 directory are inaccessible).
1800
1801 If rsync has been told to collapse symlinks (via --copy-links or
1802 --copy-unsafe-links), a symlink to a directory on another device
1803 is treated like a mount-point. Symlinks to non-directories are
1804 unaffected by this option.
1805
1806 --ignore-non-existing, --existing
1807 This tells rsync to skip creating files (including directories)
1808 that do not exist yet on the destination. If this option is
1809 combined with the --ignore-existing option, no files will be up‐
1810 dated (which can be useful if all you want to do is delete ex‐
1811 traneous files).
1812
1813 This option is a transfer rule, not an exclude, so it doesn't
1814 affect the data that goes into the file-lists, and thus it
1815 doesn't affect deletions. It just limits the files that the re‐
1816 ceiver requests to be transferred.
1817
1818 --ignore-existing
1819 This tells rsync to skip updating files that already exist on
1820 the destination (this does not ignore existing directories, or
1821 nothing would get done). See also --ignore-non-existing.
1822
1823 This option is a transfer rule, not an exclude, so it doesn't
1824 affect the data that goes into the file-lists, and thus it
1825 doesn't affect deletions. It just limits the files that the re‐
1826 ceiver requests to be transferred.
1827
1828 This option can be useful for those doing backups using the
1829 --link-dest option when they need to continue a backup run that
1830 got interrupted. Since a --link-dest run is copied into a new
1831 directory hierarchy (when it is used properly), using [--ignore-
1832 existing will ensure that the already-handled files don't get
1833 tweaked (which avoids a change in permissions on the hard-linked
1834 files). This does mean that this option is only looking at the
1835 existing files in the destination hierarchy itself.
1836
1837 When --info=skip2 is used rsync will output "FILENAME exists
1838 (INFO)" messages where the INFO indicates one of "type change",
1839 "sum change" (requires -c), "file change" (based on the quick
1840 check), "attr change", or "uptodate". Using --info=skip1 (which
1841 is also implied by 2 -v options) outputs the exists message
1842 without the INFO suffix.
1843
1844 --remove-source-files
1845 This tells rsync to remove from the sending side the files
1846 (meaning non-directories) that are a part of the transfer and
1847 have been successfully duplicated on the receiving side.
1848
1849 Note that you should only use this option on source files that
1850 are quiescent. If you are using this to move files that show up
1851 in a particular directory over to another host, make sure that
1852 the finished files get renamed into the source directory, not
1853 directly written into it, so that rsync can't possibly transfer
1854 a file that is not yet fully written. If you can't first write
1855 the files into a different directory, you should use a naming
1856 idiom that lets rsync avoid transferring files that are not yet
1857 finished (e.g. name the file "foo.new" when it is written, re‐
1858 name it to "foo" when it is done, and then use the option --ex‐
1859 clude='*.new' for the rsync transfer).
1860
1861 Starting with 3.1.0, rsync will skip the sender-side removal
1862 (and output an error) if the file's size or modify time has not
1863 stayed unchanged.
1864
1865 --delete
1866 This tells rsync to delete extraneous files from the receiving
1867 side (ones that aren't on the sending side), but only for the
1868 directories that are being synchronized. You must have asked
1869 rsync to send the whole directory (e.g. "dir" or "dir/") without
1870 using a wildcard for the directory's contents (e.g. "dir/*")
1871 since the wildcard is expanded by the shell and rsync thus gets
1872 a request to transfer individual files, not the files' parent
1873 directory. Files that are excluded from the transfer are also
1874 excluded from being deleted unless you use the --delete-excluded
1875 option or mark the rules as only matching on the sending side
1876 (see the include/exclude modifiers in the FILTER RULES section).
1877
1878 Prior to rsync 2.6.7, this option would have no effect unless
1879 --recursive was enabled. Beginning with 2.6.7, deletions will
1880 also occur when --dirs (-d) is enabled, but only for directories
1881 whose contents are being copied.
1882
1883 This option can be dangerous if used incorrectly! It is a very
1884 good idea to first try a run using the --dry-run (-n) option to
1885 see what files are going to be deleted.
1886
1887 If the sending side detects any I/O errors, then the deletion of
1888 any files at the destination will be automatically disabled.
1889 This is to prevent temporary filesystem failures (such as NFS
1890 errors) on the sending side from causing a massive deletion of
1891 files on the destination. You can override this with the --ig‐
1892 nore-errors option.
1893
1894 The --delete option may be combined with one of the --delete-
1895 WHEN options without conflict, as well as --delete-excluded.
1896 However, if none of the --delete-WHEN options are specified,
1897 rsync will choose the --delete-during algorithm when talking to
1898 rsync 3.0.0 or newer, or the --delete-before algorithm when
1899 talking to an older rsync. See also --delete-delay and
1900 --delete-after.
1901
1902 --delete-before
1903 Request that the file-deletions on the receiving side be done
1904 before the transfer starts. See --delete (which is implied) for
1905 more details on file-deletion.
1906
1907 Deleting before the transfer is helpful if the filesystem is
1908 tight for space and removing extraneous files would help to make
1909 the transfer possible. However, it does introduce a delay be‐
1910 fore the start of the transfer, and this delay might cause the
1911 transfer to timeout (if --timeout was specified). It also
1912 forces rsync to use the old, non-incremental recursion algorithm
1913 that requires rsync to scan all the files in the transfer into
1914 memory at once (see --recursive).
1915
1916 --delete-during, --del
1917 Request that the file-deletions on the receiving side be done
1918 incrementally as the transfer happens. The per-directory delete
1919 scan is done right before each directory is checked for updates,
1920 so it behaves like a more efficient --delete-before, including
1921 doing the deletions prior to any per-directory filter files be‐
1922 ing updated. This option was first added in rsync version
1923 2.6.4. See --delete (which is implied) for more details on
1924 file-deletion.
1925
1926 --delete-delay
1927 Request that the file-deletions on the receiving side be com‐
1928 puted during the transfer (like --delete-during), and then re‐
1929 moved after the transfer completes. This is useful when com‐
1930 bined with --delay-updates and/or --fuzzy, and is more efficient
1931 than using --delete-after (but can behave differently, since
1932 --delete-after computes the deletions in a separate pass after
1933 all updates are done). If the number of removed files overflows
1934 an internal buffer, a temporary file will be created on the re‐
1935 ceiving side to hold the names (it is removed while open, so you
1936 shouldn't see it during the transfer). If the creation of the
1937 temporary file fails, rsync will try to fall back to using
1938 --delete-after (which it cannot do if --recursive is doing an
1939 incremental scan). See --delete (which is implied) for more de‐
1940 tails on file-deletion.
1941
1942 --delete-after
1943 Request that the file-deletions on the receiving side be done
1944 after the transfer has completed. This is useful if you are
1945 sending new per-directory merge files as a part of the transfer
1946 and you want their exclusions to take effect for the delete
1947 phase of the current transfer. It also forces rsync to use the
1948 old, non-incremental recursion algorithm that requires rsync to
1949 scan all the files in the transfer into memory at once (see
1950 --recursive). See --delete (which is implied) for more details
1951 on file-deletion.
1952
1953 See also the --delete-delay option that might be a faster choice
1954 for those that just want the deletions to occur at the end of
1955 the transfer.
1956
1957 --delete-excluded
1958 In addition to deleting the files on the receiving side that are
1959 not on the sending side, this tells rsync to also delete any
1960 files on the receiving side that are excluded (see --exclude).
1961 See the FILTER RULES section for a way to make individual exclu‐
1962 sions behave this way on the receiver, and for a way to protect
1963 files from --delete-excluded. See --delete (which is implied)
1964 for more details on file-deletion.
1965
1966 --ignore-missing-args
1967 When rsync is first processing the explicitly requested source
1968 files (e.g. command-line arguments or --files-from entries), it
1969 is normally an error if the file cannot be found. This option
1970 suppresses that error, and does not try to transfer the file.
1971 This does not affect subsequent vanished-file errors if a file
1972 was initially found to be present and later is no longer there.
1973
1974 --delete-missing-args
1975 This option takes the behavior of the (implied) --ignore-miss‐
1976 ing-args option a step farther: each missing arg will become a
1977 deletion request of the corresponding destination file on the
1978 receiving side (should it exist). If the destination file is a
1979 non-empty directory, it will only be successfully deleted if
1980 --force or --delete are in effect. Other than that, this option
1981 is independent of any other type of delete processing.
1982
1983 The missing source files are represented by special file-list
1984 entries which display as a "*missing" entry in the --list-only
1985 output.
1986
1987 --ignore-errors
1988 Tells --delete to go ahead and delete files even when there are
1989 I/O errors.
1990
1991 --force
1992 This option tells rsync to delete a non-empty directory when it
1993 is to be replaced by a non-directory. This is only relevant if
1994 deletions are not active (see --delete for details).
1995
1996 Note for older rsync versions: --force used to still be required
1997 when using --delete-after, and it used to be non-functional un‐
1998 less the --recursive option was also enabled.
1999
2000 --max-delete=NUM
2001 This tells rsync not to delete more than NUM files or directo‐
2002 ries. If that limit is exceeded, all further deletions are
2003 skipped through the end of the transfer. At the end, rsync out‐
2004 puts a warning (including a count of the skipped deletions) and
2005 exits with an error code of 25 (unless some more important error
2006 condition also occurred).
2007
2008 Beginning with version 3.0.0, you may specify --max-delete=0 to
2009 be warned about any extraneous files in the destination without
2010 removing any of them. Older clients interpreted this as "unlim‐
2011 ited", so if you don't know what version the client is, you can
2012 use the less obvious --max-delete=-1 as a backward-compatible
2013 way to specify that no deletions be allowed (though really old
2014 versions didn't warn when the limit was exceeded).
2015
2016 --max-size=SIZE
2017 This tells rsync to avoid transferring any file that is larger
2018 than the specified SIZE. A numeric value can be suffixed with a
2019 string to indicate the numeric units or left unqualified to
2020 specify bytes. Feel free to use a fractional value along with
2021 the units, such as --max-size=1.5m.
2022
2023 This option is a transfer rule, not an exclude, so it doesn't
2024 affect the data that goes into the file-lists, and thus it
2025 doesn't affect deletions. It just limits the files that the re‐
2026 ceiver requests to be transferred.
2027
2028 The first letter of a units string can be B (bytes), K (kilo), M
2029 (mega), G (giga), T (tera), or P (peta). If the string is a
2030 single char or has "ib" added to it (e.g. "G" or "GiB") then the
2031 units are multiples of 1024. If you use a two-letter suffix
2032 that ends with a "B" (e.g. "kb") then you get units that are
2033 multiples of 1000. The string's letters can be any mix of upper
2034 and lower-case that you want to use.
2035
2036 Finally, if the string ends with either "+1" or "-1", it is off‐
2037 set by one byte in the indicated direction. The largest possi‐
2038 ble value is usually 8192P-1.
2039
2040 Examples: --max-size=1.5mb-1 is 1499999 bytes, and --max-
2041 size=2g+1 is 2147483649 bytes.
2042
2043 Note that rsync versions prior to 3.1.0 did not allow --max-
2044 size=0.
2045
2046 --min-size=SIZE
2047 This tells rsync to avoid transferring any file that is smaller
2048 than the specified SIZE, which can help in not transferring
2049 small, junk files. See the --max-size option for a description
2050 of SIZE and other info.
2051
2052 Note that rsync versions prior to 3.1.0 did not allow --min-
2053 size=0.
2054
2055 --max-alloc=SIZE
2056 By default rsync limits an individual malloc/realloc to about
2057 1GB in size. For most people this limit works just fine and
2058 prevents a protocol error causing rsync to request massive
2059 amounts of memory. However, if you have many millions of files
2060 in a transfer, a large amount of server memory, and you don't
2061 want to split up your transfer into multiple parts, you can in‐
2062 crease the per-allocation limit to something larger and rsync
2063 will consume more memory.
2064
2065 Keep in mind that this is not a limit on the total size of allo‐
2066 cated memory. It is a sanity-check value for each individual
2067 allocation.
2068
2069 See the --max-size option for a description of how SIZE can be
2070 specified. The default suffix if none is given is bytes.
2071
2072 Beginning in 3.2.3, a value of 0 specifies no limit.
2073
2074 You can set a default value using the environment variable
2075 RSYNC_MAX_ALLOC using the same SIZE values as supported by this
2076 option. If the remote rsync doesn't understand the --max-alloc
2077 option, you can override an environmental value by specifying
2078 --max-alloc=1g, which will make rsync avoid sending the option
2079 to the remote side (because "1G" is the default).
2080
2081 --block-size=SIZE, -B
2082 This forces the block size used in rsync's delta-transfer algo‐
2083 rithm to a fixed value. It is normally selected based on the
2084 size of each file being updated. See the technical report for
2085 details.
2086
2087 Beginning in 3.2.3 the SIZE can be specified with a suffix as
2088 detailed in the --max-size option. Older versions only accepted
2089 a byte count.
2090
2091 --rsh=COMMAND, -e
2092 This option allows you to choose an alternative remote shell
2093 program to use for communication between the local and remote
2094 copies of rsync. Typically, rsync is configured to use ssh by
2095 default, but you may prefer to use rsh on a local network.
2096
2097 If this option is used with [user@]host::module/path, then the
2098 remote shell COMMAND will be used to run an rsync daemon on the
2099 remote host, and all data will be transmitted through that re‐
2100 mote shell connection, rather than through a direct socket con‐
2101 nection to a running rsync daemon on the remote host. See the
2102 USING RSYNC-DAEMON FEATURES VIA A REMOTE-SHELL CONNECTION sec‐
2103 tion above.
2104
2105 Beginning with rsync 3.2.0, the RSYNC_PORT environment variable
2106 will be set when a daemon connection is being made via a remote-
2107 shell connection. It is set to 0 if the default daemon port is
2108 being assumed, or it is set to the value of the rsync port that
2109 was specified via either the --port option or a non-empty port
2110 value in an rsync:// URL. This allows the script to discern if
2111 a non-default port is being requested, allowing for things such
2112 as an SSL or stunnel helper script to connect to a default or
2113 alternate port.
2114
2115 Command-line arguments are permitted in COMMAND provided that
2116 COMMAND is presented to rsync as a single argument. You must
2117 use spaces (not tabs or other whitespace) to separate the com‐
2118 mand and args from each other, and you can use single- and/or
2119 double-quotes to preserve spaces in an argument (but not back‐
2120 slashes). Note that doubling a single-quote inside a single-
2121 quoted string gives you a single-quote; likewise for double-
2122 quotes (though you need to pay attention to which quotes your
2123 shell is parsing and which quotes rsync is parsing). Some exam‐
2124 ples:
2125
2126 -e 'ssh -p 2234'
2127 -e 'ssh -o "ProxyCommand nohup ssh firewall nc -w1 %h %p"'
2128
2129 (Note that ssh users can alternately customize site-specific
2130 connect options in their .ssh/config file.)
2131
2132 You can also choose the remote shell program using the RSYNC_RSH
2133 environment variable, which accepts the same range of values as
2134 -e.
2135
2136 See also the --blocking-io option which is affected by this op‐
2137 tion.
2138
2139 --rsync-path=PROGRAM
2140 Use this to specify what program is to be run on the remote ma‐
2141 chine to start-up rsync. Often used when rsync is not in the
2142 default remote-shell's path (e.g. --rsync-path=/usr/lo‐
2143 cal/bin/rsync). Note that PROGRAM is run with the help of a
2144 shell, so it can be any program, script, or command sequence
2145 you'd care to run, so long as it does not corrupt the standard-
2146 in & standard-out that rsync is using to communicate.
2147
2148 One tricky example is to set a different default directory on
2149 the remote machine for use with the --relative option. For in‐
2150 stance:
2151
2152 rsync -avR --rsync-path="cd /a/b && rsync" host:c/d /e/
2153
2154 --remote-option=OPTION, -M
2155 This option is used for more advanced situations where you want
2156 certain effects to be limited to one side of the transfer only.
2157 For instance, if you want to pass --log-file=FILE and --fake-su‐
2158 per to the remote system, specify it like this:
2159
2160 rsync -av -M --log-file=foo -M--fake-super src/ dest/
2161
2162 If you want to have an option affect only the local side of a
2163 transfer when it normally affects both sides, send its negation
2164 to the remote side. Like this:
2165
2166 rsync -av -x -M--no-x src/ dest/
2167
2168 Be cautious using this, as it is possible to toggle an option
2169 that will cause rsync to have a different idea about what data
2170 to expect next over the socket, and that will make it fail in a
2171 cryptic fashion.
2172
2173 Note that you should use a separate -M option for each remote
2174 option you want to pass. On older rsync versions, the presence
2175 of any spaces in the remote-option arg could cause it to be
2176 split into separate remote args, but this requires the use of
2177 --old-args in a modern rsync.
2178
2179 When performing a local transfer, the "local" side is the sender
2180 and the "remote" side is the receiver.
2181
2182 Note some versions of the popt option-parsing library have a bug
2183 in them that prevents you from using an adjacent arg with an
2184 equal in it next to a short option letter (e.g. -M--log-
2185 file=/tmp/foo). If this bug affects your version of popt, you
2186 can use the version of popt that is included with rsync.
2187
2188 --cvs-exclude, -C
2189 This is a useful shorthand for excluding a broad range of files
2190 that you often don't want to transfer between systems. It uses
2191 a similar algorithm to CVS to determine if a file should be ig‐
2192 nored.
2193
2194 The exclude list is initialized to exclude the following items
2195 (these initial items are marked as perishable -- see the FILTER
2196 RULES section):
2197
2198 RCS SCCS CVS CVS.adm RCSLOG cvslog.* tags TAGS .make.state
2199 .nse_depinfo *~ #* .#* ,* _$* *$ *.old *.bak *.BAK *.orig
2200 *.rej .del-* *.a *.olb *.o *.obj *.so *.exe *.Z *.elc *.ln
2201 core .svn/ .git/ .hg/ .bzr/
2202
2203 then, files listed in a $HOME/.cvsignore are added to the list
2204 and any files listed in the CVSIGNORE environment variable (all
2205 cvsignore names are delimited by whitespace).
2206
2207 Finally, any file is ignored if it is in the same directory as a
2208 .cvsignore file and matches one of the patterns listed therein.
2209 Unlike rsync's filter/exclude files, these patterns are split on
2210 whitespace. See the cvs(1) manual for more information.
2211
2212 If you're combining -C with your own --filter rules, you should
2213 note that these CVS excludes are appended at the end of your own
2214 rules, regardless of where the -C was placed on the command-
2215 line. This makes them a lower priority than any rules you spec‐
2216 ified explicitly. If you want to control where these CVS ex‐
2217 cludes get inserted into your filter rules, you should omit the
2218 -C as a command-line option and use a combination of --filter=:C
2219 and --filter=-C (either on your command-line or by putting the
2220 ":C" and "-C" rules into a filter file with your other rules).
2221 The first option turns on the per-directory scanning for the
2222 .cvsignore file. The second option does a one-time import of
2223 the CVS excludes mentioned above.
2224
2225 --filter=RULE, -f
2226 This option allows you to add rules to selectively exclude cer‐
2227 tain files from the list of files to be transferred. This is
2228 most useful in combination with a recursive transfer.
2229
2230 You may use as many --filter options on the command line as you
2231 like to build up the list of files to exclude. If the filter
2232 contains whitespace, be sure to quote it so that the shell gives
2233 the rule to rsync as a single argument. The text below also
2234 mentions that you can use an underscore to replace the space
2235 that separates a rule from its arg.
2236
2237 See the FILTER RULES section for detailed information on this
2238 option.
2239
2240 -F The -F option is a shorthand for adding two --filter rules to
2241 your command. The first time it is used is a shorthand for this
2242 rule:
2243
2244 --filter='dir-merge /.rsync-filter'
2245
2246 This tells rsync to look for per-directory .rsync-filter files
2247 that have been sprinkled through the hierarchy and use their
2248 rules to filter the files in the transfer. If -F is repeated,
2249 it is a shorthand for this rule:
2250
2251 --filter='exclude .rsync-filter'
2252
2253 This filters out the .rsync-filter files themselves from the
2254 transfer.
2255
2256 See the FILTER RULES section for detailed information on how
2257 these options work.
2258
2259 --exclude=PATTERN
2260 This option is a simplified form of the --filter option that de‐
2261 faults to an exclude rule and does not allow the full rule-pars‐
2262 ing syntax of normal filter rules.
2263
2264 See the FILTER RULES section for detailed information on this
2265 option.
2266
2267 --exclude-from=FILE
2268 This option is related to the --exclude option, but it specifies
2269 a FILE that contains exclude patterns (one per line). Blank
2270 lines in the file are ignored, as are whole-line comments that
2271 start with ';' or '#' (filename rules that contain those charac‐
2272 ters are unaffected).
2273
2274 If FILE is '-', the list will be read from standard input.
2275
2276 --include=PATTERN
2277 This option is a simplified form of the --filter option that de‐
2278 faults to an include rule and does not allow the full rule-pars‐
2279 ing syntax of normal filter rules.
2280
2281 See the FILTER RULES section for detailed information on this
2282 option.
2283
2284 --include-from=FILE
2285 This option is related to the --include option, but it specifies
2286 a FILE that contains include patterns (one per line). Blank
2287 lines in the file are ignored, as are whole-line comments that
2288 start with ';' or '#' (filename rules that contain those charac‐
2289 ters are unaffected).
2290
2291 If FILE is '-', the list will be read from standard input.
2292
2293 --files-from=FILE
2294 Using this option allows you to specify the exact list of files
2295 to transfer (as read from the specified FILE or '-' for standard
2296 input). It also tweaks the default behavior of rsync to make
2297 transferring just the specified files and directories easier:
2298
2299 o The --relative (-R) option is implied, which preserves
2300 the path information that is specified for each item in
2301 the file (use --no-relative or --no-R if you want to turn
2302 that off).
2303
2304 o The --dirs (-d) option is implied, which will create di‐
2305 rectories specified in the list on the destination rather
2306 than noisily skipping them (use --no-dirs or --no-d if
2307 you want to turn that off).
2308
2309 o The --archive (-a) option's behavior does not imply --re‐
2310 cursive (-r), so specify it explicitly, if you want it.
2311
2312 o These side-effects change the default state of rsync, so
2313 the position of the --files-from option on the command-
2314 line has no bearing on how other options are parsed (e.g.
2315 -a works the same before or after --files-from, as does
2316 --no-R and all other options).
2317
2318 The filenames that are read from the FILE are all relative to
2319 the source dir -- any leading slashes are removed and no ".."
2320 references are allowed to go higher than the source dir. For
2321 example, take this command:
2322
2323 rsync -a --files-from=/tmp/foo /usr remote:/backup
2324
2325 If /tmp/foo contains the string "bin" (or even "/bin"), the
2326 /usr/bin directory will be created as /backup/bin on the remote
2327 host. If it contains "bin/" (note the trailing slash), the im‐
2328 mediate contents of the directory would also be sent (without
2329 needing to be explicitly mentioned in the file -- this began in
2330 version 2.6.4). In both cases, if the -r option was enabled,
2331 that dir's entire hierarchy would also be transferred (keep in
2332 mind that -r needs to be specified explicitly with --files-from,
2333 since it is not implied by -a. Also note that the effect of the
2334 (enabled by default) -r option is to duplicate only the path
2335 info that is read from the file -- it does not force the dupli‐
2336 cation of the source-spec path (/usr in this case).
2337
2338 In addition, the --files-from file can be read from the remote
2339 host instead of the local host if you specify a "host:" in front
2340 of the file (the host must match one end of the transfer). As a
2341 short-cut, you can specify just a prefix of ":" to mean "use the
2342 remote end of the transfer". For example:
2343
2344 rsync -a --files-from=:/path/file-list src:/ /tmp/copy
2345
2346 This would copy all the files specified in the /path/file-list
2347 file that was located on the remote "src" host.
2348
2349 If the --iconv and --protect-args options are specified and the
2350 --files-from filenames are being sent from one host to another,
2351 the filenames will be translated from the sending host's charset
2352 to the receiving host's charset.
2353
2354 NOTE: sorting the list of files in the --files-from input helps
2355 rsync to be more efficient, as it will avoid re-visiting the
2356 path elements that are shared between adjacent entries. If the
2357 input is not sorted, some path elements (implied directories)
2358 may end up being scanned multiple times, and rsync will eventu‐
2359 ally unduplicate them after they get turned into file-list ele‐
2360 ments.
2361
2362 --from0, -0
2363 This tells rsync that the rules/filenames it reads from a file
2364 are terminated by a null ('\0') character, not a NL, CR, or
2365 CR+LF. This affects --exclude-from, --include-from, --files-
2366 from, and any merged files specified in a --filter rule. It
2367 does not affect --cvs-exclude (since all names read from a
2368 .cvsignore file are split on whitespace).
2369
2370 --old-args
2371 This option tells rsync to stop trying to protect the arg values
2372 on the remote side from unintended word-splitting or other mis‐
2373 interpretation.
2374
2375 The default in a modern rsync is for "shell-active" characters
2376 (including spaces) to be backslash-escaped in the args that are
2377 sent to the remote shell. The wildcard characters *, ?, [, & ]
2378 are not escaped in filename args (allowing them to expand into
2379 multiple filenames) while being protected in option args, such
2380 as --usermap.
2381
2382 If you have a script that wants to use old-style arg splitting
2383 in its filenames, specify this option once. If the remote shell
2384 has a problem with any backslash escapes at all, specify this
2385 option twice.
2386
2387 You may also control this setting via the RSYNC_OLD_ARGS envi‐
2388 ronment variable. If it has the value "1", rsync will default
2389 to a single-option setting. If it has the value "2" (or more),
2390 rsync will default to a repeated-option setting. If it is "0",
2391 you'll get the default escaping behavior. The environment is
2392 always overridden by manually specified positive or negative op‐
2393 tions (the negative is --no-old-args).
2394
2395 This option conflicts with the --protect-args option.
2396
2397 --protect-args, -s
2398 This option sends all filenames and most options to the remote
2399 rsync without allowing the remote shell to interpret them.
2400 Wildcards are expanded on the remote host by rsync instead of
2401 the shell doing it.
2402
2403 This is similar to the new-style backslash-escaping of args that
2404 was added in 3.2.4, but supports some extra features and doesn't
2405 rely on backslash escaping in the remote shell.
2406
2407 If you use this option with --iconv, the args related to the re‐
2408 mote side will also be translated from the local to the remote
2409 character-set. The translation happens before wild-cards are
2410 expanded. See also the --files-from option.
2411
2412 You may also control this setting via the RSYNC_PROTECT_ARGS en‐
2413 vironment variable. If it has a non-zero value, this setting
2414 will be enabled by default, otherwise it will be disabled by de‐
2415 fault. Either state is overridden by a manually specified posi‐
2416 tive or negative version of this option (note that --no-s and
2417 --no-protect-args are the negative versions). This environment
2418 variable is also superseded by a non-zero RSYNC_OLD_ARGS export.
2419
2420 You may need to disable this option when interacting with an
2421 older rsync (one prior to 3.0.0).
2422
2423 This option conflicts with the --old-args option.
2424
2425 Note that this option is incompatible with the use of the re‐
2426 stricted rsync script (rrsync) since it hides options from the
2427 script's inspection.
2428
2429 --copy-as=USER[:GROUP]
2430 This option instructs rsync to use the USER and (if specified
2431 after a colon) the GROUP for the copy operations. This only
2432 works if the user that is running rsync has the ability to
2433 change users. If the group is not specified then the user's de‐
2434 fault groups are used.
2435
2436 This option can help to reduce the risk of an rsync being run as
2437 root into or out of a directory that might have live changes
2438 happening to it and you want to make sure that root-level read
2439 or write actions of system files are not possible. While you
2440 could alternatively run all of rsync as the specified user,
2441 sometimes you need the root-level host-access credentials to be
2442 used, so this allows rsync to drop root for the copying part of
2443 the operation after the remote-shell or daemon connection is es‐
2444 tablished.
2445
2446 The option only affects one side of the transfer unless the
2447 transfer is local, in which case it affects both sides. Use the
2448 --remote-option to affect the remote side, such as -M--copy-
2449 as=joe. For a local transfer, the lsh (or lsh.sh) support file
2450 provides a local-shell helper script that can be used to allow a
2451 "localhost:" or "lh:" host-spec to be specified without needing
2452 to setup any remote shells, allowing you to specify remote op‐
2453 tions that affect the side of the transfer that is using the
2454 host-spec (and using hostname "lh" avoids the overriding of the
2455 remote directory to the user's home dir).
2456
2457 For example, the following rsync writes the local files as user
2458 "joe":
2459
2460 sudo rsync -aiv --copy-as=joe host1:backups/joe/ /home/joe/
2461
2462 This makes all files owned by user "joe", limits the groups to
2463 those that are available to that user, and makes it impossible
2464 for the joe user to do a timed exploit of the path to induce a
2465 change to a file that the joe user has no permissions to change.
2466
2467 The following command does a local copy into the "dest/" dir as
2468 user "joe" (assuming you've installed support/lsh into a dir on
2469 your $PATH):
2470
2471 sudo rsync -aive lsh -M--copy-as=joe src/ lh:dest/
2472
2473 --temp-dir=DIR, -T
2474 This option instructs rsync to use DIR as a scratch directory
2475 when creating temporary copies of the files transferred on the
2476 receiving side. The default behavior is to create each tempo‐
2477 rary file in the same directory as the associated destination
2478 file. Beginning with rsync 3.1.1, the temp-file names inside
2479 the specified DIR will not be prefixed with an extra dot (though
2480 they will still have a random suffix added).
2481
2482 This option is most often used when the receiving disk partition
2483 does not have enough free space to hold a copy of the largest
2484 file in the transfer. In this case (i.e. when the scratch di‐
2485 rectory is on a different disk partition), rsync will not be
2486 able to rename each received temporary file over the top of the
2487 associated destination file, but instead must copy it into
2488 place. Rsync does this by copying the file over the top of the
2489 destination file, which means that the destination file will
2490 contain truncated data during this copy. If this were not done
2491 this way (even if the destination file were first removed, the
2492 data locally copied to a temporary file in the destination di‐
2493 rectory, and then renamed into place) it would be possible for
2494 the old file to continue taking up disk space (if someone had it
2495 open), and thus there might not be enough room to fit the new
2496 version on the disk at the same time.
2497
2498 If you are using this option for reasons other than a shortage
2499 of disk space, you may wish to combine it with the --delay-up‐
2500 dates option, which will ensure that all copied files get put
2501 into subdirectories in the destination hierarchy, awaiting the
2502 end of the transfer. If you don't have enough room to duplicate
2503 all the arriving files on the destination partition, another way
2504 to tell rsync that you aren't overly concerned about disk space
2505 is to use the --partial-dir option with a relative path; because
2506 this tells rsync that it is OK to stash off a copy of a single
2507 file in a subdir in the destination hierarchy, rsync will use
2508 the partial-dir as a staging area to bring over the copied file,
2509 and then rename it into place from there. (Specifying a --par‐
2510 tial-dir with an absolute path does not have this side-effect.)
2511
2512 --fuzzy, -y
2513 This option tells rsync that it should look for a basis file for
2514 any destination file that is missing. The current algorithm
2515 looks in the same directory as the destination file for either a
2516 file that has an identical size and modified-time, or a simi‐
2517 larly-named file. If found, rsync uses the fuzzy basis file to
2518 try to speed up the transfer.
2519
2520 If the option is repeated, the fuzzy scan will also be done in
2521 any matching alternate destination directories that are speci‐
2522 fied via --compare-dest, --copy-dest, or --link-dest.
2523
2524 Note that the use of the --delete option might get rid of any
2525 potential fuzzy-match files, so either use --delete-after or
2526 specify some filename exclusions if you need to prevent this.
2527
2528 --compare-dest=DIR
2529 This option instructs rsync to use DIR on the destination ma‐
2530 chine as an additional hierarchy to compare destination files
2531 against doing transfers (if the files are missing in the desti‐
2532 nation directory). If a file is found in DIR that is identical
2533 to the sender's file, the file will NOT be transferred to the
2534 destination directory. This is useful for creating a sparse
2535 backup of just files that have changed from an earlier backup.
2536 This option is typically used to copy into an empty (or newly
2537 created) directory.
2538
2539 Beginning in version 2.6.4, multiple --compare-dest directories
2540 may be provided, which will cause rsync to search the list in
2541 the order specified for an exact match. If a match is found
2542 that differs only in attributes, a local copy is made and the
2543 attributes updated. If a match is not found, a basis file from
2544 one of the DIRs will be selected to try to speed up the trans‐
2545 fer.
2546
2547 If DIR is a relative path, it is relative to the destination di‐
2548 rectory. See also --copy-dest and --link-dest.
2549
2550 NOTE: beginning with version 3.1.0, rsync will remove a file
2551 from a non-empty destination hierarchy if an exact match is
2552 found in one of the compare-dest hierarchies (making the end re‐
2553 sult more closely match a fresh copy).
2554
2555 --copy-dest=DIR
2556 This option behaves like --compare-dest, but rsync will also
2557 copy unchanged files found in DIR to the destination directory
2558 using a local copy. This is useful for doing transfers to a new
2559 destination while leaving existing files intact, and then doing
2560 a flash-cutover when all files have been successfully trans‐
2561 ferred.
2562
2563 Multiple --copy-dest directories may be provided, which will
2564 cause rsync to search the list in the order specified for an un‐
2565 changed file. If a match is not found, a basis file from one of
2566 the DIRs will be selected to try to speed up the transfer.
2567
2568 If DIR is a relative path, it is relative to the destination di‐
2569 rectory. See also --compare-dest and --link-dest.
2570
2571 --link-dest=DIR
2572 This option behaves like --copy-dest, but unchanged files are
2573 hard linked from DIR to the destination directory. The files
2574 must be identical in all preserved attributes (e.g. permissions,
2575 possibly ownership) in order for the files to be linked to‐
2576 gether. An example:
2577
2578 rsync -av --link-dest=$PWD/prior_dir host:src_dir/ new_dir/
2579
2580 If files aren't linking, double-check their attributes. Also
2581 check if some attributes are getting forced outside of rsync's
2582 control, such a mount option that squishes root to a single
2583 user, or mounts a removable drive with generic ownership (such
2584 as OS X's "Ignore ownership on this volume" option).
2585
2586 Beginning in version 2.6.4, multiple --link-dest directories may
2587 be provided, which will cause rsync to search the list in the
2588 order specified for an exact match (there is a limit of 20 such
2589 directories). If a match is found that differs only in at‐
2590 tributes, a local copy is made and the attributes updated. If a
2591 match is not found, a basis file from one of the DIRs will be
2592 selected to try to speed up the transfer.
2593
2594 This option works best when copying into an empty destination
2595 hierarchy, as existing files may get their attributes tweaked,
2596 and that can affect alternate destination files via hard-links.
2597 Also, itemizing of changes can get a bit muddled. Note that
2598 prior to version 3.1.0, an alternate-directory exact match would
2599 never be found (nor linked into the destination) when a destina‐
2600 tion file already exists.
2601
2602 Note that if you combine this option with --ignore-times, rsync
2603 will not link any files together because it only links identical
2604 files together as a substitute for transferring the file, never
2605 as an additional check after the file is updated.
2606
2607 If DIR is a relative path, it is relative to the destination di‐
2608 rectory. See also --compare-dest and --copy-dest.
2609
2610 Note that rsync versions prior to 2.6.1 had a bug that could
2611 prevent --link-dest from working properly for a non-super-user
2612 when --owner (-o) was specified (or implied). You can work-
2613 around this bug by avoiding the -o option (or using --no-o) when
2614 sending to an old rsync.
2615
2616 --compress, -z
2617 With this option, rsync compresses the file data as it is sent
2618 to the destination machine, which reduces the amount of data be‐
2619 ing transmitted -- something that is useful over a slow connec‐
2620 tion.
2621
2622 Rsync supports multiple compression methods and will choose one
2623 for you unless you force the choice using the --compress-choice
2624 (--zc) option.
2625
2626 Run rsync --version to see the default compress list compiled
2627 into your version.
2628
2629 When both sides of the transfer are at least 3.2.0, rsync
2630 chooses the first algorithm in the client's list of choices that
2631 is also in the server's list of choices. If no common compress
2632 choice is found, rsync exits with an error. If the remote rsync
2633 is too old to support checksum negotiation, its list is assumed
2634 to be "zlib".
2635
2636 The default order can be customized by setting the environment
2637 variable RSYNC_COMPRESS_LIST to a space-separated list of ac‐
2638 ceptable compression names. If the string contains a "&" char‐
2639 acter, it is separated into the "client string & server string",
2640 otherwise the same string applies to both. If the string (or
2641 string portion) contains no non-whitespace characters, the de‐
2642 fault compress list is used. Any unknown compression names are
2643 discarded from the list, but a list with only invalid names re‐
2644 sults in a failed negotiation.
2645
2646 There are some older rsync versions that were configured to re‐
2647 ject a -z option and require the use of -zz because their com‐
2648 pression library was not compatible with the default zlib com‐
2649 pression method. You can usually ignore this weirdness unless
2650 the rsync server complains and tells you to specify -zz.
2651
2652 --compress-choice=STR, --zc=STR
2653 This option can be used to override the automatic negotiation of
2654 the compression algorithm that occurs when --compress is used.
2655 The option implies --compress unless "none" was specified, which
2656 instead implies --no-compress.
2657
2658 The compression options that you may be able to use are:
2659
2660 o zstd
2661
2662 o lz4
2663
2664 o zlibx
2665
2666 o zlib
2667
2668 o none
2669
2670 Run rsync --version to see the default compress list compiled
2671 into your version (which may differ from the list above).
2672
2673 Note that if you see an error about an option named --old-com‐
2674 press or --new-compress, this is rsync trying to send the --com‐
2675 press-choice=zlib or --compress-choice=zlibx option in a back‐
2676 ward-compatible manner that more rsync versions understand.
2677 This error indicates that the older rsync version on the server
2678 will not allow you to force the compression type.
2679
2680 Note that the "zlibx" compression algorithm is just the "zlib"
2681 algorithm with matched data excluded from the compression stream
2682 (to try to make it more compatible with an external zlib imple‐
2683 mentation).
2684
2685 --compress-level=NUM, --zl=NUM
2686 Explicitly set the compression level to use (see --compress, -z)
2687 instead of letting it default. The --compress option is implied
2688 as long as the level chosen is not a "don't compress" level for
2689 the compression algorithm that is in effect (e.g. zlib compres‐
2690 sion treats level 0 as "off").
2691
2692 The level values vary depending on the checksum in effect. Be‐
2693 cause rsync will negotiate a checksum choice by default (when
2694 the remote rsync is new enough), it can be good to combine this
2695 option with a --compress-choice (--zc) option unless you're sure
2696 of the choice in effect. For example:
2697
2698 rsync -aiv --zc=zstd --zl=22 host:src/ dest/
2699
2700 For zlib & zlibx compression the valid values are from 1 to 9
2701 with 6 being the default. Specifying --zl=0 turns compression
2702 off, and specifying --zl=-1 chooses the default level of 6.
2703
2704 For zstd compression the valid values are from -131072 to 22
2705 with 3 being the default. Specifying 0 chooses the default of 3.
2706
2707 For lz4 compression there are no levels, so the value is always
2708 0.
2709
2710 If you specify a too-large or too-small value, the number is
2711 silently limited to a valid value. This allows you to specify
2712 something like --zl=999999999 and be assured that you'll end up
2713 with the maximum compression level no matter what algorithm was
2714 chosen.
2715
2716 If you want to know the compression level that is in effect,
2717 specify --debug=nstr to see the "negotiated string" results.
2718 This will report something like "Client com‐
2719 press: zstd (level 3)" (along with the checksum choice in ef‐
2720 fect).
2721
2722 --skip-compress=LIST
2723 NOTE: no compression method currently supports per-file compres‐
2724 sion changes, so this option has no effect.
2725
2726 Override the list of file suffixes that will be compressed as
2727 little as possible. Rsync sets the compression level on a per-
2728 file basis based on the file's suffix. If the compression algo‐
2729 rithm has an "off" level, then no compression occurs for those
2730 files. Other algorithms that support changing the streaming
2731 level on-the-fly will have the level minimized to reduces the
2732 CPU usage as much as possible for a matching file.
2733
2734 The LIST should be one or more file suffixes (without the dot)
2735 separated by slashes (/). You may specify an empty string to
2736 indicate that no files should be skipped.
2737
2738 Simple character-class matching is supported: each must consist
2739 of a list of letters inside the square brackets (e.g. no special
2740 classes, such as "[:alpha:]", are supported, and '-' has no spe‐
2741 cial meaning).
2742
2743 The characters asterisk (*) and question-mark (?) have no spe‐
2744 cial meaning.
2745
2746 Here's an example that specifies 6 suffixes to skip (since 1 of
2747 the 5 rules matches 2 suffixes):
2748
2749 --skip-compress=gz/jpg/mp[34]/7z/bz2
2750
2751 The default file suffixes in the skip-compress list in this ver‐
2752 sion of rsync are:
2753
2754 3g2 3gp 7z aac ace apk avi bz2 deb dmg ear f4v flac flv gpg
2755 gz iso jar jpeg jpg lrz lz lz4 lzma lzo m1a m1v m2a m2ts m2v
2756 m4a m4b m4p m4r m4v mka mkv mov mp1 mp2 mp3 mp4 mpa mpeg mpg
2757 mpv mts odb odf odg odi odm odp ods odt oga ogg ogm ogv ogx
2758 opus otg oth otp ots ott oxt png qt rar rpm rz rzip spx
2759 squashfs sxc sxd sxg sxm sxw sz tbz tbz2 tgz tlz ts txz tzo
2760 vob war webm webp xz z zip zst
2761
2762 This list will be replaced by your --skip-compress list in all
2763 but one situation: a copy from a daemon rsync will add your
2764 skipped suffixes to its list of non-compressing files (and its
2765 list may be configured to a different default).
2766
2767 --numeric-ids
2768 With this option rsync will transfer numeric group and user IDs
2769 rather than using user and group names and mapping them at both
2770 ends.
2771
2772 By default rsync will use the username and groupname to deter‐
2773 mine what ownership to give files. The special uid 0 and the
2774 special group 0 are never mapped via user/group names even if
2775 the --numeric-ids option is not specified.
2776
2777 If a user or group has no name on the source system or it has no
2778 match on the destination system, then the numeric ID from the
2779 source system is used instead. See also the use chroot setting
2780 in the rsyncd.conf manpage for some comments on how the chroot
2781 setting affects rsync's ability to look up the names of the
2782 users and groups and what you can do about it.
2783
2784 --usermap=STRING, --groupmap=STRING
2785 These options allow you to specify users and groups that should
2786 be mapped to other values by the receiving side. The STRING is
2787 one or more FROM:TO pairs of values separated by commas. Any
2788 matching FROM value from the sender is replaced with a TO value
2789 from the receiver. You may specify usernames or user IDs for
2790 the FROM and TO values, and the FROM value may also be a wild-
2791 card string, which will be matched against the sender's names
2792 (wild-cards do NOT match against ID numbers, though see below
2793 for why a '*' matches everything). You may instead specify a
2794 range of ID numbers via an inclusive range: LOW-HIGH. For exam‐
2795 ple:
2796
2797 --usermap=0-99:nobody,wayne:admin,*:normal --groupmap=usr:1,1:usr
2798
2799 The first match in the list is the one that is used. You should
2800 specify all your user mappings using a single --usermap option,
2801 and/or all your group mappings using a single --groupmap option.
2802
2803 Note that the sender's name for the 0 user and group are not
2804 transmitted to the receiver, so you should either match these
2805 values using a 0, or use the names in effect on the receiving
2806 side (typically "root"). All other FROM names match those in
2807 use on the sending side. All TO names match those in use on the
2808 receiving side.
2809
2810 Any IDs that do not have a name on the sending side are treated
2811 as having an empty name for the purpose of matching. This al‐
2812 lows them to be matched via a "*" or using an empty name. For
2813 instance:
2814
2815 --usermap=:nobody --groupmap=*:nobody
2816
2817 When the --numeric-ids option is used, the sender does not send
2818 any names, so all the IDs are treated as having an empty name.
2819 This means that you will need to specify numeric FROM values if
2820 you want to map these nameless IDs to different values.
2821
2822 For the --usermap option to work, the receiver will need to be
2823 running as a super-user (see also the --super and --fake-super
2824 options). For the --groupmap option to work, the receiver will
2825 need to have permissions to set that group.
2826
2827 Starting with rsync 3.2.4, the --usermap option implies the
2828 --owner (-o) option while the --groupmap option implies the
2829 --group (-g) option (since rsync needs to have those options en‐
2830 abled for the mapping options to work).
2831
2832 An older rsync client may need to use --protect-args (-s) to
2833 avoid a complaint about wildcard characters, but a modern rsync
2834 handles this automatically.
2835
2836 --chown=USER:GROUP
2837 This option forces all files to be owned by USER with group
2838 GROUP. This is a simpler interface than using --usermap &
2839 --groupmap directly, but it is implemented using those options
2840 internally so they cannot be mixed. If either the USER or GROUP
2841 is empty, no mapping for the omitted user/group will occur. If
2842 GROUP is empty, the trailing colon may be omitted, but if USER
2843 is empty, a leading colon must be supplied.
2844
2845 If you specify "--chown=foo:bar", this is exactly the same as
2846 specifying "--usermap=*:foo --groupmap=*:bar", only easier (and
2847 with the same implied --owner and/or --group options).
2848
2849 An older rsync client may need to use --protect-args (-s) to
2850 avoid a complaint about wildcard characters, but a modern rsync
2851 handles this automatically.
2852
2853 --timeout=SECONDS
2854 This option allows you to set a maximum I/O timeout in seconds.
2855 If no data is transferred for the specified time then rsync will
2856 exit. The default is 0, which means no timeout.
2857
2858 --contimeout=SECONDS
2859 This option allows you to set the amount of time that rsync will
2860 wait for its connection to an rsync daemon to succeed. If the
2861 timeout is reached, rsync exits with an error.
2862
2863 --address=ADDRESS
2864 By default rsync will bind to the wildcard address when connect‐
2865 ing to an rsync daemon. The --address option allows you to
2866 specify a specific IP address (or hostname) to bind to.
2867
2868 See also the daemon version of the --address option.
2869
2870 --port=PORT
2871 This specifies an alternate TCP port number to use rather than
2872 the default of 873. This is only needed if you are using the
2873 double-colon (::) syntax to connect with an rsync daemon (since
2874 the URL syntax has a way to specify the port as a part of the
2875 URL).
2876
2877 See also the daemon version of the --port option.
2878
2879 --sockopts=OPTIONS
2880 This option can provide endless fun for people who like to tune
2881 their systems to the utmost degree. You can set all sorts of
2882 socket options which may make transfers faster (or slower!).
2883 Read the manpage for the setsockopt() system call for details on
2884 some of the options you may be able to set. By default no spe‐
2885 cial socket options are set. This only affects direct socket
2886 connections to a remote rsync daemon.
2887
2888 See also the daemon version of the --sockopts option.
2889
2890 --blocking-io
2891 This tells rsync to use blocking I/O when launching a remote
2892 shell transport. If the remote shell is either rsh or remsh,
2893 rsync defaults to using blocking I/O, otherwise it defaults to
2894 using non-blocking I/O. (Note that ssh prefers non-blocking
2895 I/O.)
2896
2897 --outbuf=MODE
2898 This sets the output buffering mode. The mode can be None (aka
2899 Unbuffered), Line, or Block (aka Full). You may specify as lit‐
2900 tle as a single letter for the mode, and use upper or lower
2901 case.
2902
2903 The main use of this option is to change Full buffering to Line
2904 buffering when rsync's output is going to a file or pipe.
2905
2906 --itemize-changes, -i
2907 Requests a simple itemized list of the changes that are being
2908 made to each file, including attribute changes. This is exactly
2909 the same as specifying --out-format='%i %n%L'. If you repeat
2910 the option, unchanged files will also be output, but only if the
2911 receiving rsync is at least version 2.6.7 (you can use -vv with
2912 older versions of rsync, but that also turns on the output of
2913 other verbose messages).
2914
2915 The "%i" escape has a cryptic output that is 11 letters long.
2916 The general format is like the string YXcstpoguax, where Y is
2917 replaced by the type of update being done, X is replaced by the
2918 file-type, and the other letters represent attributes that may
2919 be output if they are being modified.
2920
2921 The update types that replace the Y are as follows:
2922
2923 o A < means that a file is being transferred to the remote
2924 host (sent).
2925
2926 o A > means that a file is being transferred to the local
2927 host (received).
2928
2929 o A c means that a local change/creation is occurring for
2930 the item (such as the creation of a directory or the
2931 changing of a symlink, etc.).
2932
2933 o A h means that the item is a hard link to another item
2934 (requires --hard-links).
2935
2936 o A . means that the item is not being updated (though it
2937 might have attributes that are being modified).
2938
2939 o A * means that the rest of the itemized-output area con‐
2940 tains a message (e.g. "deleting").
2941
2942 The file-types that replace the X are: f for a file, a d for a
2943 directory, an L for a symlink, a D for a device, and a S for a
2944 special file (e.g. named sockets and fifos).
2945
2946 The other letters in the string indicate if some attributes of
2947 the file have changed, as follows:
2948
2949 o "." - the attribute is unchanged.
2950
2951 o "+" - the file is newly created.
2952
2953 o " " - all the attributes are unchanged (all dots turn to
2954 spaces).
2955
2956 o "?" - the change is unknown (when the remote rsync is
2957 old).
2958
2959 o A letter indicates an attribute is being updated.
2960
2961 The attribute that is associated with each letter is as follows:
2962
2963 o A c means either that a regular file has a different
2964 checksum (requires --checksum) or that a symlink, device,
2965 or special file has a changed value. Note that if you
2966 are sending files to an rsync prior to 3.0.1, this change
2967 flag will be present only for checksum-differing regular
2968 files.
2969
2970 o A s means the size of a regular file is different and
2971 will be updated by the file transfer.
2972
2973 o A t means the modification time is different and is being
2974 updated to the sender's value (requires --times). An al‐
2975 ternate value of T means that the modification time will
2976 be set to the transfer time, which happens when a
2977 file/symlink/device is updated without --times and when a
2978 symlink is changed and the receiver can't set its time.
2979 (Note: when using an rsync 3.0.0 client, you might see
2980 the s flag combined with t instead of the proper T flag
2981 for this time-setting failure.)
2982
2983 o A p means the permissions are different and are being up‐
2984 dated to the sender's value (requires --perms).
2985
2986 o An o means the owner is different and is being updated to
2987 the sender's value (requires --owner and super-user priv‐
2988 ileges).
2989
2990 o A g means the group is different and is being updated to
2991 the sender's value (requires --group and the authority to
2992 set the group).
2993
2994 o
2995
2996 o A u|n|b indicates the following information:
2997
2998 u means the access (use) time is different and is
2999 being updated to the sender's value (requires
3000 --atimes)
3001
3002 o n means the create time (newness) is different and
3003 is being updated to the sender's value (requires
3004 --crtimes)
3005
3006 o b means that both the access and create times are
3007 being updated
3008
3009 o The a means that the ACL information is being changed.
3010
3011 o The x means that the extended attribute information is
3012 being changed.
3013
3014 One other output is possible: when deleting files, the "%i" will
3015 output the string "*deleting" for each item that is being re‐
3016 moved (assuming that you are talking to a recent enough rsync
3017 that it logs deletions instead of outputting them as a verbose
3018 message).
3019
3020 --out-format=FORMAT
3021 This allows you to specify exactly what the rsync client outputs
3022 to the user on a per-update basis. The format is a text string
3023 containing embedded single-character escape sequences prefixed
3024 with a percent (%) character. A default format of "%n%L" is as‐
3025 sumed if either --info=name or -v is specified (this tells you
3026 just the name of the file and, if the item is a link, where it
3027 points). For a full list of the possible escape characters, see
3028 the log format setting in the rsyncd.conf manpage.
3029
3030 Specifying the --out-format option implies the --info=name op‐
3031 tion, which will mention each file, dir, etc. that gets updated
3032 in a significant way (a transferred file, a recreated sym‐
3033 link/device, or a touched directory). In addition, if the item‐
3034 ize-changes escape (%i) is included in the string (e.g. if the
3035 --itemize-changes option was used), the logging of names in‐
3036 creases to mention any item that is changed in any way (as long
3037 as the receiving side is at least 2.6.4). See the --itemize-
3038 changes option for a description of the output of "%i".
3039
3040 Rsync will output the out-format string prior to a file's trans‐
3041 fer unless one of the transfer-statistic escapes is requested,
3042 in which case the logging is done at the end of the file's
3043 transfer. When this late logging is in effect and --progress is
3044 also specified, rsync will also output the name of the file be‐
3045 ing transferred prior to its progress information (followed, of
3046 course, by the out-format output).
3047
3048 --log-file=FILE
3049 This option causes rsync to log what it is doing to a file.
3050 This is similar to the logging that a daemon does, but can be
3051 requested for the client side and/or the server side of a non-
3052 daemon transfer. If specified as a client option, transfer log‐
3053 ging will be enabled with a default format of "%i %n%L". See
3054 the --log-file-format option if you wish to override this.
3055
3056 Here's a example command that requests the remote side to log
3057 what is happening:
3058
3059 rsync -av --remote-option=--log-file=/tmp/rlog src/ dest/
3060
3061 This is very useful if you need to debug why a connection is
3062 closing unexpectedly.
3063
3064 See also the daemon version of the --log-file option.
3065
3066 --log-file-format=FORMAT
3067 This allows you to specify exactly what per-update logging is
3068 put into the file specified by the --log-file option (which must
3069 also be specified for this option to have any effect). If you
3070 specify an empty string, updated files will not be mentioned in
3071 the log file. For a list of the possible escape characters, see
3072 the log format setting in the rsyncd.conf manpage.
3073
3074 The default FORMAT used if --log-file is specified and this op‐
3075 tion is not is '%i %n%L'.
3076
3077 See also the daemon version of the --log-file-format option.
3078
3079 --stats
3080 This tells rsync to print a verbose set of statistics on the
3081 file transfer, allowing you to tell how effective rsync's delta-
3082 transfer algorithm is for your data. This option is equivalent
3083 to --info=stats2 if combined with 0 or 1 -v options, or
3084 --info=stats3 if combined with 2 or more -v options.
3085
3086 The current statistics are as follows:
3087
3088 o Number of files is the count of all "files" (in the
3089 generic sense), which includes directories, symlinks,
3090 etc. The total count will be followed by a list of
3091 counts by filetype (if the total is non-zero). For exam‐
3092 ple: "(reg: 5, dir: 3, link: 2, dev: 1, special: 1)"
3093 lists the totals for regular files, directories, sym‐
3094 links, devices, and special files. If any of value is 0,
3095 it is completely omitted from the list.
3096
3097 o Number of created files is the count of how many "files"
3098 (generic sense) were created (as opposed to updated).
3099 The total count will be followed by a list of counts by
3100 filetype (if the total is non-zero).
3101
3102 o Number of deleted files is the count of how many "files"
3103 (generic sense) were deleted. The total count will be
3104 followed by a list of counts by filetype (if the total is
3105 non-zero). Note that this line is only output if dele‐
3106 tions are in effect, and only if protocol 31 is being
3107 used (the default for rsync 3.1.x).
3108
3109 o Number of regular files transferred is the count of nor‐
3110 mal files that were updated via rsync's delta-transfer
3111 algorithm, which does not include dirs, symlinks, etc.
3112 Note that rsync 3.1.0 added the word "regular" into this
3113 heading.
3114
3115 o Total file size is the total sum of all file sizes in the
3116 transfer. This does not count any size for directories
3117 or special files, but does include the size of symlinks.
3118
3119 o Total transferred file size is the total sum of all files
3120 sizes for just the transferred files.
3121
3122 o Literal data is how much unmatched file-update data we
3123 had to send to the receiver for it to recreate the up‐
3124 dated files.
3125
3126 o Matched data is how much data the receiver got locally
3127 when recreating the updated files.
3128
3129 o File list size is how big the file-list data was when the
3130 sender sent it to the receiver. This is smaller than the
3131 in-memory size for the file list due to some compressing
3132 of duplicated data when rsync sends the list.
3133
3134 o File list generation time is the number of seconds that
3135 the sender spent creating the file list. This requires a
3136 modern rsync on the sending side for this to be present.
3137
3138 o File list transfer time is the number of seconds that the
3139 sender spent sending the file list to the receiver.
3140
3141 o Total bytes sent is the count of all the bytes that rsync
3142 sent from the client side to the server side.
3143
3144 o Total bytes received is the count of all non-message
3145 bytes that rsync received by the client side from the
3146 server side. "Non-message" bytes means that we don't
3147 count the bytes for a verbose message that the server
3148 sent to us, which makes the stats more consistent.
3149
3150 --8-bit-output, -8
3151 This tells rsync to leave all high-bit characters unescaped in
3152 the output instead of trying to test them to see if they're
3153 valid in the current locale and escaping the invalid ones. All
3154 control characters (but never tabs) are always escaped, regard‐
3155 less of this option's setting.
3156
3157 The escape idiom that started in 2.6.7 is to output a literal
3158 backslash (\) and a hash (#), followed by exactly 3 octal dig‐
3159 its. For example, a newline would output as "\#012". A literal
3160 backslash that is in a filename is not escaped unless it is fol‐
3161 lowed by a hash and 3 digits (0-9).
3162
3163 --human-readable, -h
3164 Output numbers in a more human-readable format. There are 3
3165 possible levels:
3166
3167 1. output numbers with a separator between each set of 3
3168 digits (either a comma or a period, depending on if the
3169 decimal point is represented by a period or a comma).
3170
3171 2. output numbers in units of 1000 (with a character suffix
3172 for larger units -- see below).
3173
3174 3. output numbers in units of 1024.
3175
3176 The default is human-readable level 1. Each -h option increases
3177 the level by one. You can take the level down to 0 (to output
3178 numbers as pure digits) by specifying the --no-human-readable
3179 (--no-h) option.
3180
3181 The unit letters that are appended in levels 2 and 3 are: K
3182 (kilo), M (mega), G (giga), T (tera), or P (peta). For example,
3183 a 1234567-byte file would output as 1.23M in level-2 (assuming
3184 that a period is your local decimal point).
3185
3186 Backward compatibility note: versions of rsync prior to 3.1.0 do
3187 not support human-readable level 1, and they default to level 0.
3188 Thus, specifying one or two -h options will behave in a compara‐
3189 ble manner in old and new versions as long as you didn't specify
3190 a --no-h option prior to one or more -h options. See the
3191 --list-only option for one difference.
3192
3193 --partial
3194 By default, rsync will delete any partially transferred file if
3195 the transfer is interrupted. In some circumstances it is more
3196 desirable to keep partially transferred files. Using the --par‐
3197 tial option tells rsync to keep the partial file which should
3198 make a subsequent transfer of the rest of the file much faster.
3199
3200 --partial-dir=DIR
3201 This option modifies the behavior of the --partial option while
3202 also implying that it be enabled. This enhanced partial-file
3203 method puts any partially transferred files into the specified
3204 DIR instead of writing the partial file out to the destination
3205 file. On the next transfer, rsync will use a file found in this
3206 dir as data to speed up the resumption of the transfer and then
3207 delete it after it has served its purpose.
3208
3209 Note that if --whole-file is specified (or implied), any par‐
3210 tial-dir files that are found for a file that is being updated
3211 will simply be removed (since rsync is sending files without us‐
3212 ing rsync's delta-transfer algorithm).
3213
3214 Rsync will create the DIR if it is missing, but just the last
3215 dir -- not the whole path. This makes it easy to use a relative
3216 path (such as "--partial-dir=.rsync-partial") to have rsync cre‐
3217 ate the partial-directory in the destination file's directory
3218 when it is needed, and then remove it again when the partial
3219 file is deleted. Note that this directory removal is only done
3220 for a relative pathname, as it is expected that an absolute path
3221 is to a directory that is reserved for partial-dir work.
3222
3223 If the partial-dir value is not an absolute path, rsync will add
3224 an exclude rule at the end of all your existing excludes. This
3225 will prevent the sending of any partial-dir files that may exist
3226 on the sending side, and will also prevent the untimely deletion
3227 of partial-dir items on the receiving side. An example: the
3228 above --partial-dir option would add the equivalent of this
3229 "perishable" exclude at the end of any other filter rules:
3230 -f '-p .rsync-partial/'
3231
3232 If you are supplying your own exclude rules, you may need to add
3233 your own exclude/hide/protect rule for the partial-dir because:
3234
3235 1. the auto-added rule may be ineffective at the end of your
3236 other rules, or
3237
3238 2. you may wish to override rsync's exclude choice.
3239
3240 For instance, if you want to make rsync clean-up any left-over
3241 partial-dirs that may be lying around, you should specify
3242 --delete-after and add a "risk" filter rule, e.g. -f 'R .rsync-
3243 partial/'. Avoid using --delete-before or --delete-during unless
3244 you don't need rsync to use any of the left-over partial-dir
3245 data during the current run.
3246
3247 IMPORTANT: the --partial-dir should not be writable by other
3248 users or it is a security risk! E.g. AVOID "/tmp"!
3249
3250 You can also set the partial-dir value the RSYNC_PARTIAL_DIR en‐
3251 vironment variable. Setting this in the environment does not
3252 force --partial to be enabled, but rather it affects where par‐
3253 tial files go when --partial is specified. For instance, in‐
3254 stead of using --partial-dir=.rsync-tmp along with --progress,
3255 you could set RSYNC_PARTIAL_DIR=.rsync-tmp in your environment
3256 and then use the -P option to turn on the use of the .rsync-tmp
3257 dir for partial transfers. The only times that the --partial
3258 option does not look for this environment value are:
3259
3260 1. when --inplace was specified (since --inplace conflicts
3261 with --partial-dir), and
3262
3263 2. when --delay-updates was specified (see below).
3264
3265 When a modern rsync resumes the transfer of a file in the par‐
3266 tial-dir, that partial file is now updated in-place instead of
3267 creating yet another tmp-file copy (so it maxes out at dest +
3268 tmp instead of dest + partial + tmp). This requires both ends
3269 of the transfer to be at least version 3.2.0.
3270
3271 For the purposes of the daemon-config's "refuse options" set‐
3272 ting, --partial-dir does not imply --partial. This is so that a
3273 refusal of the --partial option can be used to disallow the
3274 overwriting of destination files with a partial transfer, while
3275 still allowing the safer idiom provided by --partial-dir.
3276
3277 --delay-updates
3278 This option puts the temporary file from each updated file into
3279 a holding directory until the end of the transfer, at which time
3280 all the files are renamed into place in rapid succession. This
3281 attempts to make the updating of the files a little more atomic.
3282 By default the files are placed into a directory named .~tmp~ in
3283 each file's destination directory, but if you've specified the
3284 --partial-dir option, that directory will be used instead. See
3285 the comments in the --partial-dir section for a discussion of
3286 how this .~tmp~ dir will be excluded from the transfer, and what
3287 you can do if you want rsync to cleanup old .~tmp~ dirs that
3288 might be lying around. Conflicts with --inplace and --append.
3289
3290 This option implies --no-inc-recursive since it needs the full
3291 file list in memory in order to be able to iterate over it at
3292 the end.
3293
3294 This option uses more memory on the receiving side (one bit per
3295 file transferred) and also requires enough free disk space on
3296 the receiving side to hold an additional copy of all the updated
3297 files. Note also that you should not use an absolute path to
3298 --partial-dir unless:
3299
3300 1. there is no chance of any of the files in the transfer
3301 having the same name (since all the updated files will be
3302 put into a single directory if the path is absolute), and
3303
3304 2. there are no mount points in the hierarchy (since the de‐
3305 layed updates will fail if they can't be renamed into
3306 place).
3307
3308 See also the "atomic-rsync" python script in the "support" sub‐
3309 dir for an update algorithm that is even more atomic (it uses
3310 --link-dest and a parallel hierarchy of files).
3311
3312 --prune-empty-dirs, -m
3313 This option tells the receiving rsync to get rid of empty direc‐
3314 tories from the file-list, including nested directories that
3315 have no non-directory children. This is useful for avoiding the
3316 creation of a bunch of useless directories when the sending
3317 rsync is recursively scanning a hierarchy of files using in‐
3318 clude/exclude/filter rules.
3319
3320 Note that the use of transfer rules, such as the --min-size op‐
3321 tion, does not affect what goes into the file list, and thus
3322 does not leave directories empty, even if none of the files in a
3323 directory match the transfer rule.
3324
3325 Because the file-list is actually being pruned, this option also
3326 affects what directories get deleted when a delete is active.
3327 However, keep in mind that excluded files and directories can
3328 prevent existing items from being deleted due to an exclude both
3329 hiding source files and protecting destination files. See the
3330 perishable filter-rule option for how to avoid this.
3331
3332 You can prevent the pruning of certain empty directories from
3333 the file-list by using a global "protect" filter. For instance,
3334 this option would ensure that the directory "emptydir" was kept
3335 in the file-list:
3336
3337 --filter 'protect emptydir/'
3338
3339 Here's an example that copies all .pdf files in a hierarchy,
3340 only creating the necessary destination directories to hold the
3341 .pdf files, and ensures that any superfluous files and directo‐
3342 ries in the destination are removed (note the hide filter of
3343 non-directories being used instead of an exclude):
3344
3345 rsync -avm --del --include='*.pdf' -f 'hide,! */' src/ dest
3346
3347 If you didn't want to remove superfluous destination files, the
3348 more time-honored options of --include='*/' --exclude='*' would
3349 work fine in place of the hide-filter (if that is more natural
3350 to you).
3351
3352 --progress
3353 This option tells rsync to print information showing the
3354 progress of the transfer. This gives a bored user something to
3355 watch. With a modern rsync this is the same as specifying
3356 --info=flist2,name,progress, but any user-supplied settings for
3357 those info flags takes precedence (e.g.
3358 --info=flist0 --progress).
3359
3360 While rsync is transferring a regular file, it updates a
3361 progress line that looks like this:
3362
3363 782448 63% 110.64kB/s 0:00:04
3364
3365 In this example, the receiver has reconstructed 782448 bytes or
3366 63% of the sender's file, which is being reconstructed at a rate
3367 of 110.64 kilobytes per second, and the transfer will finish in
3368 4 seconds if the current rate is maintained until the end.
3369
3370 These statistics can be misleading if rsync's delta-transfer al‐
3371 gorithm is in use. For example, if the sender's file consists
3372 of the basis file followed by additional data, the reported rate
3373 will probably drop dramatically when the receiver gets to the
3374 literal data, and the transfer will probably take much longer to
3375 finish than the receiver estimated as it was finishing the
3376 matched part of the file.
3377
3378 When the file transfer finishes, rsync replaces the progress
3379 line with a summary line that looks like this:
3380
3381 1,238,099 100% 146.38kB/s 0:00:08 (xfr#5, to-chk=169/396)
3382
3383 In this example, the file was 1,238,099 bytes long in total, the
3384 average rate of transfer for the whole file was 146.38 kilobytes
3385 per second over the 8 seconds that it took to complete, it was
3386 the 5th transfer of a regular file during the current rsync ses‐
3387 sion, and there are 169 more files for the receiver to check (to
3388 see if they are up-to-date or not) remaining out of the 396 to‐
3389 tal files in the file-list.
3390
3391 In an incremental recursion scan, rsync won't know the total
3392 number of files in the file-list until it reaches the ends of
3393 the scan, but since it starts to transfer files during the scan,
3394 it will display a line with the text "ir-chk" (for incremental
3395 recursion check) instead of "to-chk" until the point that it
3396 knows the full size of the list, at which point it will switch
3397 to using "to-chk". Thus, seeing "ir-chk" lets you know that the
3398 total count of files in the file list is still going to increase
3399 (and each time it does, the count of files left to check will
3400 increase by the number of the files added to the list).
3401
3402 -P The -P option is equivalent to "--partial --progress". Its pur‐
3403 pose is to make it much easier to specify these two options for
3404 a long transfer that may be interrupted.
3405
3406 There is also a --info=progress2 option that outputs statistics
3407 based on the whole transfer, rather than individual files. Use
3408 this flag without outputting a filename (e.g. avoid -v or spec‐
3409 ify --info=name0) if you want to see how the transfer is doing
3410 without scrolling the screen with a lot of names. (You don't
3411 need to specify the --progress option in order to use
3412 --info=progress2.)
3413
3414 Finally, you can get an instant progress report by sending rsync
3415 a signal of either SIGINFO or SIGVTALRM. On BSD systems, a SIG‐
3416 INFO is generated by typing a Ctrl+T (Linux doesn't currently
3417 support a SIGINFO signal). When the client-side process re‐
3418 ceives one of those signals, it sets a flag to output a single
3419 progress report which is output when the current file transfer
3420 finishes (so it may take a little time if a big file is being
3421 handled when the signal arrives). A filename is output (if
3422 needed) followed by the --info=progress2 format of progress
3423 info. If you don't know which of the 3 rsync processes is the
3424 client process, it's OK to signal all of them (since the non-
3425 client processes ignore the signal).
3426
3427 CAUTION: sending SIGVTALRM to an older rsync (pre-3.2.0) will
3428 kill it.
3429
3430 --password-file=FILE
3431 This option allows you to provide a password for accessing an
3432 rsync daemon via a file or via standard input if FILE is -. The
3433 file should contain just the password on the first line (all
3434 other lines are ignored). Rsync will exit with an error if FILE
3435 is world readable or if a root-run rsync command finds a non-
3436 root-owned file.
3437
3438 This option does not supply a password to a remote shell trans‐
3439 port such as ssh; to learn how to do that, consult the remote
3440 shell's documentation. When accessing an rsync daemon using a
3441 remote shell as the transport, this option only comes into ef‐
3442 fect after the remote shell finishes its authentication (i.e. if
3443 you have also specified a password in the daemon's config file).
3444
3445 --early-input=FILE
3446 This option allows rsync to send up to 5K of data to the "early
3447 exec" script on its stdin. One possible use of this data is to
3448 give the script a secret that can be used to mount an encrypted
3449 filesystem (which you should unmount in the the "post-xfer exec"
3450 script).
3451
3452 The daemon must be at least version 3.2.1.
3453
3454 --list-only
3455 This option will cause the source files to be listed instead of
3456 transferred. This option is inferred if there is a single
3457 source arg and no destination specified, so its main uses are:
3458
3459 1. to turn a copy command that includes a destination arg
3460 into a file-listing command, or
3461
3462 2. to be able to specify more than one source arg. Note: be
3463 sure to include the destination.
3464
3465 CAUTION: keep in mind that a source arg with a wild-card is ex‐
3466 panded by the shell into multiple args, so it is never safe to
3467 try to list such an arg without using this option. For example:
3468
3469 rsync -av --list-only foo* dest/
3470
3471 Starting with rsync 3.1.0, the sizes output by --list-only are
3472 affected by the --human-readable option. By default they will
3473 contain digit separators, but higher levels of readability will
3474 output the sizes with unit suffixes. Note also that the column
3475 width for the size output has increased from 11 to 14 characters
3476 for all human-readable levels. Use --no-h if you want just dig‐
3477 its in the sizes, and the old column width of 11 characters.
3478
3479 Compatibility note: when requesting a remote listing of files
3480 from an rsync that is version 2.6.3 or older, you may encounter
3481 an error if you ask for a non-recursive listing. This is be‐
3482 cause a file listing implies the --dirs option w/o --recursive,
3483 and older rsyncs don't have that option. To avoid this problem,
3484 either specify the --no-dirs option (if you don't need to expand
3485 a directory's content), or turn on recursion and exclude the
3486 content of subdirectories: -r --exclude='/*/*'.
3487
3488 --bwlimit=RATE
3489 This option allows you to specify the maximum transfer rate for
3490 the data sent over the socket, specified in units per second.
3491 The RATE value can be suffixed with a string to indicate a size
3492 multiplier, and may be a fractional value (e.g. --bwlimit=1.5m).
3493 If no suffix is specified, the value will be assumed to be in
3494 units of 1024 bytes (as if "K" or "KiB" had been appended). See
3495 the --max-size option for a description of all the available
3496 suffixes. A value of 0 specifies no limit.
3497
3498 For backward-compatibility reasons, the rate limit will be
3499 rounded to the nearest KiB unit, so no rate smaller than 1024
3500 bytes per second is possible.
3501
3502 Rsync writes data over the socket in blocks, and this option
3503 both limits the size of the blocks that rsync writes, and tries
3504 to keep the average transfer rate at the requested limit. Some
3505 burstiness may be seen where rsync writes out a block of data
3506 and then sleeps to bring the average rate into compliance.
3507
3508 Due to the internal buffering of data, the --progress option may
3509 not be an accurate reflection on how fast the data is being
3510 sent. This is because some files can show up as being rapidly
3511 sent when the data is quickly buffered, while other can show up
3512 as very slow when the flushing of the output buffer occurs.
3513 This may be fixed in a future version.
3514
3515 See also the daemon version of the --bwlimit option.
3516
3517 --stop-after=MINS, (--time-limit=MINS)
3518 This option tells rsync to stop copying when the specified num‐
3519 ber of minutes has elapsed.
3520
3521 For maximal flexibility, rsync does not communicate this option
3522 to the remote rsync since it is usually enough that one side of
3523 the connection quits as specified. This allows the option's use
3524 even when only one side of the connection supports it. You can
3525 tell the remote side about the time limit using --remote-option
3526 (-M), should the need arise.
3527
3528 The --time-limit version of this option is deprecated.
3529
3530 --stop-at=y-m-dTh:m
3531 This option tells rsync to stop copying when the specified point
3532 in time has been reached. The date & time can be fully specified
3533 in a numeric format of year-month-dayThour:minute (e.g.
3534 2000-12-31T23:59) in the local timezone. You may choose to sep‐
3535 arate the date numbers using slashes instead of dashes.
3536
3537 The value can also be abbreviated in a variety of ways, such as
3538 specifying a 2-digit year and/or leaving off various values. In
3539 all cases, the value will be taken to be the next possible point
3540 in time where the supplied information matches. If the value
3541 specifies the current time or a past time, rsync exits with an
3542 error.
3543
3544 For example, "1-30" specifies the next January 30th (at midnight
3545 local time), "14:00" specifies the next 2 P.M., "1" specifies
3546 the next 1st of the month at midnight, "31" specifies the next
3547 month where we can stop on its 31st day, and ":59" specifies the
3548 next 59th minute after the hour.
3549
3550 For maximal flexibility, rsync does not communicate this option
3551 to the remote rsync since it is usually enough that one side of
3552 the connection quits as specified. This allows the option's use
3553 even when only one side of the connection supports it. You can
3554 tell the remote side about the time limit using --remote-option
3555 (-M), should the need arise. Do keep in mind that the remote
3556 host may have a different default timezone than your local host.
3557
3558 --fsync
3559 Cause the receiving side to fsync each finished file. This may
3560 slow down the transfer, but can help to provide peace of mind
3561 when updating critical files.
3562
3563 --write-batch=FILE
3564 Record a file that can later be applied to another identical
3565 destination with --read-batch. See the "BATCH MODE" section for
3566 details, and also the --only-write-batch option.
3567
3568 This option overrides the negotiated checksum & compress lists
3569 and always negotiates a choice based on old-school md5/md4/zlib
3570 choices. If you want a more modern choice, use the --checksum-
3571 choice (--cc) and/or --compress-choice (--zc) options.
3572
3573 --only-write-batch=FILE
3574 Works like --write-batch, except that no updates are made on the
3575 destination system when creating the batch. This lets you
3576 transport the changes to the destination system via some other
3577 means and then apply the changes via --read-batch.
3578
3579 Note that you can feel free to write the batch directly to some
3580 portable media: if this media fills to capacity before the end
3581 of the transfer, you can just apply that partial transfer to the
3582 destination and repeat the whole process to get the rest of the
3583 changes (as long as you don't mind a partially updated destina‐
3584 tion system while the multi-update cycle is happening).
3585
3586 Also note that you only save bandwidth when pushing changes to a
3587 remote system because this allows the batched data to be di‐
3588 verted from the sender into the batch file without having to
3589 flow over the wire to the receiver (when pulling, the sender is
3590 remote, and thus can't write the batch).
3591
3592 --read-batch=FILE
3593 Apply all of the changes stored in FILE, a file previously gen‐
3594 erated by --write-batch. If FILE is -, the batch data will be
3595 read from standard input. See the "BATCH MODE" section for de‐
3596 tails.
3597
3598 --protocol=NUM
3599 Force an older protocol version to be used. This is useful for
3600 creating a batch file that is compatible with an older version
3601 of rsync. For instance, if rsync 2.6.4 is being used with the
3602 --write-batch option, but rsync 2.6.3 is what will be used to
3603 run the --read-batch option, you should use "--protocol=28" when
3604 creating the batch file to force the older protocol version to
3605 be used in the batch file (assuming you can't upgrade the rsync
3606 on the reading system).
3607
3608 --iconv=CONVERT_SPEC
3609 Rsync can convert filenames between character sets using this
3610 option. Using a CONVERT_SPEC of "." tells rsync to look up the
3611 default character-set via the locale setting. Alternately, you
3612 can fully specify what conversion to do by giving a local and a
3613 remote charset separated by a comma in the order --iconv=LO‐
3614 CAL,REMOTE, e.g. --iconv=utf8,iso88591. This order ensures that
3615 the option will stay the same whether you're pushing or pulling
3616 files. Finally, you can specify either --no-iconv or a CON‐
3617 VERT_SPEC of "-" to turn off any conversion. The default set‐
3618 ting of this option is site-specific, and can also be affected
3619 via the RSYNC_ICONV environment variable.
3620
3621 For a list of what charset names your local iconv library sup‐
3622 ports, you can run "iconv --list".
3623
3624 If you specify the --protect-args (-s) option, rsync will trans‐
3625 late the filenames you specify on the command-line that are be‐
3626 ing sent to the remote host. See also the --files-from option.
3627
3628 Note that rsync does not do any conversion of names in filter
3629 files (including include/exclude files). It is up to you to en‐
3630 sure that you're specifying matching rules that can match on
3631 both sides of the transfer. For instance, you can specify extra
3632 include/exclude rules if there are filename differences on the
3633 two sides that need to be accounted for.
3634
3635 When you pass an --iconv option to an rsync daemon that allows
3636 it, the daemon uses the charset specified in its "charset" con‐
3637 figuration parameter regardless of the remote charset you actu‐
3638 ally pass. Thus, you may feel free to specify just the local
3639 charset for a daemon transfer (e.g. --iconv=utf8).
3640
3641 --ipv4, -4 or --ipv6, -6
3642 Tells rsync to prefer IPv4/IPv6 when creating sockets or running
3643 ssh. This affects sockets that rsync has direct control over,
3644 such as the outgoing socket when directly contacting an rsync
3645 daemon, as well as the forwarding of the -4 or -6 option to ssh
3646 when rsync can deduce that ssh is being used as the remote
3647 shell. For other remote shells you'll need to specify the
3648 "--rsh SHELL -4" option directly (or whatever IPv4/IPv6 hint op‐
3649 tions it uses).
3650
3651 See also the daemon version of these options.
3652
3653 If rsync was compiled without support for IPv6, the --ipv6 op‐
3654 tion will have no effect. The rsync --version output will con‐
3655 tain "no IPv6" if is the case.
3656
3657 --checksum-seed=NUM
3658 Set the checksum seed to the integer NUM. This 4 byte checksum
3659 seed is included in each block and MD4 file checksum calculation
3660 (the more modern MD5 file checksums don't use a seed). By de‐
3661 fault the checksum seed is generated by the server and defaults
3662 to the current time(). This option is used to set a specific
3663 checksum seed, which is useful for applications that want re‐
3664 peatable block checksums, or in the case where the user wants a
3665 more random checksum seed. Setting NUM to 0 causes rsync to use
3666 the default of time() for checksum seed.
3667
3669 The options allowed when starting an rsync daemon are as follows:
3670
3671 --daemon
3672 This tells rsync that it is to run as a daemon. The daemon you
3673 start running may be accessed using an rsync client using the
3674 host::module or rsync://host/module/ syntax.
3675
3676 If standard input is a socket then rsync will assume that it is
3677 being run via inetd, otherwise it will detach from the current
3678 terminal and become a background daemon. The daemon will read
3679 the config file (rsyncd.conf) on each connect made by a client
3680 and respond to requests accordingly.
3681
3682 See the rsyncd.conf(5) manpage for more details.
3683
3684 --address=ADDRESS
3685 By default rsync will bind to the wildcard address when run as a
3686 daemon with the --daemon option. The --address option allows
3687 you to specify a specific IP address (or hostname) to bind to.
3688 This makes virtual hosting possible in conjunction with the
3689 --config option.
3690
3691 See also the address global option in the rsyncd.conf manpage
3692 and the client version of the --address option.
3693
3694 --bwlimit=RATE
3695 This option allows you to specify the maximum transfer rate for
3696 the data the daemon sends over the socket. The client can still
3697 specify a smaller --bwlimit value, but no larger value will be
3698 allowed.
3699
3700 See the client version of the --bwlimit option for some extra
3701 details.
3702
3703 --config=FILE
3704 This specifies an alternate config file than the default. This
3705 is only relevant when --daemon is specified. The default is
3706 /etc/rsyncd.conf unless the daemon is running over a remote
3707 shell program and the remote user is not the super-user; in that
3708 case the default is rsyncd.conf in the current directory (typi‐
3709 cally $HOME).
3710
3711 --dparam=OVERRIDE, -M
3712 This option can be used to set a daemon-config parameter when
3713 starting up rsync in daemon mode. It is equivalent to adding
3714 the parameter at the end of the global settings prior to the
3715 first module's definition. The parameter names can be specified
3716 without spaces, if you so desire. For instance:
3717
3718 rsync --daemon -M pidfile=/path/rsync.pid
3719
3720 --no-detach
3721 When running as a daemon, this option instructs rsync to not de‐
3722 tach itself and become a background process. This option is re‐
3723 quired when running as a service on Cygwin, and may also be use‐
3724 ful when rsync is supervised by a program such as daemontools or
3725 AIX's System Resource Controller. --no-detach is also recom‐
3726 mended when rsync is run under a debugger. This option has no
3727 effect if rsync is run from inetd or sshd.
3728
3729 --port=PORT
3730 This specifies an alternate TCP port number for the daemon to
3731 listen on rather than the default of 873.
3732
3733 See also the client version of the --port option and the port
3734 global setting in the rsyncd.conf manpage.
3735
3736 --log-file=FILE
3737 This option tells the rsync daemon to use the given log-file
3738 name instead of using the "log file" setting in the config file.
3739
3740 See also the client version of the --log-file option.
3741
3742 --log-file-format=FORMAT
3743 This option tells the rsync daemon to use the given FORMAT
3744 string instead of using the "log format" setting in the config
3745 file. It also enables "transfer logging" unless the string is
3746 empty, in which case transfer logging is turned off.
3747
3748 See also the client version of the --log-file-format option.
3749
3750 --sockopts
3751 This overrides the socket options setting in the rsyncd.conf
3752 file and has the same syntax.
3753
3754 See also the client version of the --sockopts option.
3755
3756 --verbose, -v
3757 This option increases the amount of information the daemon logs
3758 during its startup phase. After the client connects, the dae‐
3759 mon's verbosity level will be controlled by the options that the
3760 client used and the "max verbosity" setting in the module's con‐
3761 fig section.
3762
3763 See also the client version of the --verbose option.
3764
3765 --ipv4, -4 or --ipv6, -6
3766 Tells rsync to prefer IPv4/IPv6 when creating the incoming sock‐
3767 ets that the rsync daemon will use to listen for connections.
3768 One of these options may be required in older versions of Linux
3769 to work around an IPv6 bug in the kernel (if you see an "address
3770 already in use" error when nothing else is using the port, try
3771 specifying --ipv6 or --ipv4 when starting the daemon).
3772
3773 See also the client version of these options.
3774
3775 If rsync was compiled without support for IPv6, the --ipv6 op‐
3776 tion will have no effect. The rsync --version output will con‐
3777 tain "no IPv6" if is the case.
3778
3779 --help, -h
3780 When specified after --daemon, print a short help page describ‐
3781 ing the options available for starting an rsync daemon.
3782
3784 The filter rules allow for flexible selection of which files to trans‐
3785 fer (include) and which files to skip (exclude). The rules either di‐
3786 rectly specify include/exclude patterns or they specify a way to ac‐
3787 quire more include/exclude patterns (e.g. to read them from a file).
3788
3789 As the list of files/directories to transfer is built, rsync checks
3790 each name to be transferred against the list of include/exclude pat‐
3791 terns in turn, and the first matching pattern is acted on: if it is an
3792 exclude pattern, then that file is skipped; if it is an include pattern
3793 then that filename is not skipped; if no matching pattern is found,
3794 then the filename is not skipped.
3795
3796 Aside: because the interactions of filter rules can be complex, it is
3797 useful to use the --debug=FILTER option if things aren't working the
3798 way you expect. The level-1 output (the default if no level number is
3799 specified) mentions the filter rule that is first matched by each file
3800 in the transfer. It also warns if a filter rule has trailing white‐
3801 space. The level-2 output mentions a lot more filter events, including
3802 the definition of each rule and the handling of per-directory filter
3803 files.
3804
3805 Rsync builds an ordered list of filter rules as specified on the com‐
3806 mand-line. Filter rules have the following syntax:
3807
3808 RULE [PATTERN_OR_FILENAME]
3809 RULE,MODIFIERS [PATTERN_OR_FILENAME]
3810
3811 You have your choice of using either short or long RULE names, as de‐
3812 scribed below. If you use a short-named rule, the ',' separating the
3813 RULE from the MODIFIERS is optional. The PATTERN or FILENAME that fol‐
3814 lows (when present) must come after either a single space or an under‐
3815 score (_). Here are the available rule prefixes:
3816
3817 exclude, '-'
3818 specifies an exclude pattern.
3819
3820 include, '+'
3821 specifies an include pattern.
3822
3823 merge, '.'
3824 specifies a merge-file to read for more rules.
3825
3826 dir-merge, ':'
3827 specifies a per-directory merge-file.
3828
3829 hide, 'H'
3830 specifies a pattern for hiding files from the transfer.
3831
3832 show, 'S'
3833 files that match the pattern are not hidden.
3834
3835 protect, 'P'
3836 specifies a pattern for protecting files from deletion.
3837
3838 risk, 'R'
3839 files that match the pattern are not protected.
3840
3841 clear, '!'
3842 clears the current include/exclude list (takes no arg)
3843
3844 When rules are being read from a file, empty lines are ignored, as are
3845 whole-line comments that start with a '#' (filename rules that contain
3846 a hash are unaffected).
3847
3848 Note that the --include & --exclude command-line options do not allow
3849 the full range of rule parsing as described above -- they only allow
3850 the specification of include / exclude patterns plus a "!" token to
3851 clear the list (and the normal comment parsing when rules are read from
3852 a file). If a pattern does not begin with "- " (dash, space) or "+ "
3853 (plus, space), then the rule will be interpreted as if "+ " (for an in‐
3854 clude option) or "- " (for an exclude option) were prefixed to the
3855 string. A --filter option, on the other hand, must always contain ei‐
3856 ther a short or long rule name at the start of the rule.
3857
3858 Note also that the --filter, --include, and --exclude options take one
3859 rule/pattern each. To add multiple ones, you can repeat the options on
3860 the command-line, use the merge-file syntax of the --filter option, or
3861 the --include-from / --exclude-from options.
3862
3864 You can include and exclude files by specifying patterns using the "+",
3865 "-", etc. filter rules (as introduced in the FILTER RULES section
3866 above). The include/exclude rules each specify a pattern that is
3867 matched against the names of the files that are going to be trans‐
3868 ferred. These patterns can take several forms:
3869
3870 o if the pattern starts with a / then it is anchored to a particu‐
3871 lar spot in the hierarchy of files, otherwise it is matched
3872 against the end of the pathname. This is similar to a leading ^
3873 in regular expressions. Thus /foo would match a name of "foo"
3874 at either the "root of the transfer" (for a global rule) or in
3875 the merge-file's directory (for a per-directory rule). An un‐
3876 qualified foo would match a name of "foo" anywhere in the tree
3877 because the algorithm is applied recursively from the top down;
3878 it behaves as if each path component gets a turn at being the
3879 end of the filename. Even the unanchored "sub/foo" would match
3880 at any point in the hierarchy where a "foo" was found within a
3881 directory named "sub". See the section on ANCHORING INCLUDE/EX‐
3882 CLUDE PATTERNS for a full discussion of how to specify a pattern
3883 that matches at the root of the transfer.
3884
3885 o if the pattern ends with a / then it will only match a direc‐
3886 tory, not a regular file, symlink, or device.
3887
3888 o rsync chooses between doing a simple string match and wildcard
3889 matching by checking if the pattern contains one of these three
3890 wildcard characters: '*', '?', and '[' .
3891
3892 o a '*' matches any path component, but it stops at slashes.
3893
3894 o use '**' to match anything, including slashes.
3895
3896 o a '?' matches any character except a slash (/).
3897
3898 o a '[' introduces a character class, such as [a-z] or [[:al‐
3899 pha:]].
3900
3901 o in a wildcard pattern, a backslash can be used to escape a wild‐
3902 card character, but it is matched literally when no wildcards
3903 are present. This means that there is an extra level of back‐
3904 slash removal when a pattern contains wildcard characters com‐
3905 pared to a pattern that has none. e.g. if you add a wildcard to
3906 "foo\bar" (which matches the backslash) you would need to use
3907 "foo\\bar*" to avoid the "\b" becoming just "b".
3908
3909 o if the pattern contains a / (not counting a trailing /) or a
3910 "**", then it is matched against the full pathname, including
3911 any leading directories. If the pattern doesn't contain a / or
3912 a "**", then it is matched only against the final component of
3913 the filename. (Remember that the algorithm is applied recur‐
3914 sively so "full filename" can actually be any portion of a path
3915 from the starting directory on down.)
3916
3917 o a trailing "dir_name/***" will match both the directory (as if
3918 "dir_name/" had been specified) and everything in the directory
3919 (as if "dir_name/**" had been specified). This behavior was
3920 added in version 2.6.7.
3921
3922 Note that, when using the --recursive (-r) option (which is implied by
3923 -a), every subdir component of every path is visited left to right,
3924 with each directory having a chance for exclusion before its content.
3925 In this way include/exclude patterns are applied recursively to the
3926 pathname of each node in the filesystem's tree (those inside the trans‐
3927 fer). The exclude patterns short-circuit the directory traversal stage
3928 as rsync finds the files to send.
3929
3930 For instance, to include "/foo/bar/baz", the directories "/foo" and
3931 "/foo/bar" must not be excluded. Excluding one of those parent direc‐
3932 tories prevents the examination of its content, cutting off rsync's re‐
3933 cursion into those paths and rendering the include for "/foo/bar/baz"
3934 ineffectual (since rsync can't match something it never sees in the
3935 cut-off section of the directory hierarchy).
3936
3937 The concept path exclusion is particularly important when using a
3938 trailing '*' rule. For instance, this won't work:
3939
3940 + /some/path/this-file-will-not-be-found
3941 + /file-is-included
3942 - *
3943
3944 This fails because the parent directory "some" is excluded by the '*'
3945 rule, so rsync never visits any of the files in the "some" or
3946 "some/path" directories. One solution is to ask for all directories in
3947 the hierarchy to be included by using a single rule: "+ */" (put it
3948 somewhere before the "- *" rule), and perhaps use the --prune-empty-
3949 dirs option. Another solution is to add specific include rules for all
3950 the parent dirs that need to be visited. For instance, this set of
3951 rules works fine:
3952
3953 + /some/
3954 + /some/path/
3955 + /some/path/this-file-is-found
3956 + /file-also-included
3957 - *
3958
3959 Here are some examples of exclude/include matching:
3960
3961 o "- *.o" would exclude all names matching *.o
3962
3963 o "- /foo" would exclude a file (or directory) named foo in the
3964 transfer-root directory
3965
3966 o "- foo/" would exclude any directory named foo
3967
3968 o "- /foo/*/bar" would exclude any file named bar which is at two
3969 levels below a directory named foo in the transfer-root direc‐
3970 tory
3971
3972 o "- /foo/**/bar" would exclude any file named bar two or more
3973 levels below a directory named foo in the transfer-root direc‐
3974 tory
3975
3976 o The combination of "+ */", "+ *.c", and "- *" would include all
3977 directories and C source files but nothing else (see also the
3978 --prune-empty-dirs option)
3979
3980 o The combination of "+ foo/", "+ foo/bar.c", and "- *" would in‐
3981 clude only the foo directory and foo/bar.c (the foo directory
3982 must be explicitly included or it would be excluded by the "*")
3983
3984 The following modifiers are accepted after a "+" or "-":
3985
3986 o A / specifies that the include/exclude rule should be matched
3987 against the absolute pathname of the current item. For example,
3988 "-/ /etc/passwd" would exclude the passwd file any time the
3989 transfer was sending files from the "/etc" directory, and "-/
3990 subdir/foo" would always exclude "foo" when it is in a dir named
3991 "subdir", even if "foo" is at the root of the current transfer.
3992
3993 o A ! specifies that the include/exclude should take effect if the
3994 pattern fails to match. For instance, "-! */" would exclude all
3995 non-directories.
3996
3997 o A C is used to indicate that all the global CVS-exclude rules
3998 should be inserted as excludes in place of the "-C". No arg
3999 should follow.
4000
4001 o An s is used to indicate that the rule applies to the sending
4002 side. When a rule affects the sending side, it prevents files
4003 from being transferred. The default is for a rule to affect
4004 both sides unless --delete-excluded was specified, in which case
4005 default rules become sender-side only. See also the hide (H)
4006 and show (S) rules, which are an alternate way to specify send‐
4007 ing-side includes/excludes.
4008
4009 o An r is used to indicate that the rule applies to the receiving
4010 side. When a rule affects the receiving side, it prevents files
4011 from being deleted. See the s modifier for more info. See also
4012 the protect (P) and risk (R) rules, which are an alternate way
4013 to specify receiver-side includes/excludes.
4014
4015 o A p indicates that a rule is perishable, meaning that it is ig‐
4016 nored in directories that are being deleted. For instance, the
4017 --cvs-exclude (-C) option's default rules that exclude things
4018 like "CVS" and "*.o" are marked as perishable, and will not pre‐
4019 vent a directory that was removed on the source from being
4020 deleted on the destination.
4021
4022 o An x indicates that a rule affects xattr names in xattr
4023 copy/delete operations (and is thus ignored when matching
4024 file/dir names). If no xattr-matching rules are specified, a
4025 default xattr filtering rule is used (see the --xattrs option).
4026
4028 You can merge whole files into your filter rules by specifying either a
4029 merge (.) or a dir-merge (:) filter rule (as introduced in the FILTER
4030 RULES section above).
4031
4032 There are two kinds of merged files -- single-instance ('.') and per-
4033 directory (':'). A single-instance merge file is read one time, and
4034 its rules are incorporated into the filter list in the place of the "."
4035 rule. For per-directory merge files, rsync will scan every directory
4036 that it traverses for the named file, merging its contents when the
4037 file exists into the current list of inherited rules. These per-direc‐
4038 tory rule files must be created on the sending side because it is the
4039 sending side that is being scanned for the available files to transfer.
4040 These rule files may also need to be transferred to the receiving side
4041 if you want them to affect what files don't get deleted (see PER-DIREC‐
4042 TORY RULES AND DELETE below).
4043
4044 Some examples:
4045
4046 merge /etc/rsync/default.rules
4047 . /etc/rsync/default.rules
4048 dir-merge .per-dir-filter
4049 dir-merge,n- .non-inherited-per-dir-excludes
4050 :n- .non-inherited-per-dir-excludes
4051
4052 The following modifiers are accepted after a merge or dir-merge rule:
4053
4054 o A - specifies that the file should consist of only exclude pat‐
4055 terns, with no other rule-parsing except for in-file comments.
4056
4057 o A + specifies that the file should consist of only include pat‐
4058 terns, with no other rule-parsing except for in-file comments.
4059
4060 o A C is a way to specify that the file should be read in a CVS-
4061 compatible manner. This turns on 'n', 'w', and '-', but also
4062 allows the list-clearing token (!) to be specified. If no file‐
4063 name is provided, ".cvsignore" is assumed.
4064
4065 o A e will exclude the merge-file name from the transfer; e.g.
4066 "dir-merge,e .rules" is like "dir-merge .rules" and "- .rules".
4067
4068 o An n specifies that the rules are not inherited by subdirecto‐
4069 ries.
4070
4071 o A w specifies that the rules are word-split on whitespace in‐
4072 stead of the normal line-splitting. This also turns off com‐
4073 ments. Note: the space that separates the prefix from the rule
4074 is treated specially, so "- foo + bar" is parsed as two rules
4075 (assuming that prefix-parsing wasn't also disabled).
4076
4077 o You may also specify any of the modifiers for the "+" or "-"
4078 rules (above) in order to have the rules that are read in from
4079 the file default to having that modifier set (except for the !
4080 modifier, which would not be useful). For instance, "merge,-/
4081 .excl" would treat the contents of .excl as absolute-path ex‐
4082 cludes, while "dir-merge,s .filt" and ":sC" would each make all
4083 their per-directory rules apply only on the sending side. If
4084 the merge rule specifies sides to affect (via the s or r modi‐
4085 fier or both), then the rules in the file must not specify sides
4086 (via a modifier or a rule prefix such as hide).
4087
4088 Per-directory rules are inherited in all subdirectories of the direc‐
4089 tory where the merge-file was found unless the 'n' modifier was used.
4090 Each subdirectory's rules are prefixed to the inherited per-directory
4091 rules from its parents, which gives the newest rules a higher priority
4092 than the inherited rules. The entire set of dir-merge rules are
4093 grouped together in the spot where the merge-file was specified, so it
4094 is possible to override dir-merge rules via a rule that got specified
4095 earlier in the list of global rules. When the list-clearing rule ("!")
4096 is read from a per-directory file, it only clears the inherited rules
4097 for the current merge file.
4098
4099 Another way to prevent a single rule from a dir-merge file from being
4100 inherited is to anchor it with a leading slash. Anchored rules in a
4101 per-directory merge-file are relative to the merge-file's directory, so
4102 a pattern "/foo" would only match the file "foo" in the directory where
4103 the dir-merge filter file was found.
4104
4105 Here's an example filter file which you'd specify via --fil‐
4106 ter=". file":
4107
4108 merge /home/user/.global-filter
4109 - *.gz
4110 dir-merge .rules
4111 + *.[ch]
4112 - *.o
4113 - foo*
4114
4115 This will merge the contents of the /home/user/.global-filter file at
4116 the start of the list and also turns the ".rules" filename into a per-
4117 directory filter file. All rules read in prior to the start of the di‐
4118 rectory scan follow the global anchoring rules (i.e. a leading slash
4119 matches at the root of the transfer).
4120
4121 If a per-directory merge-file is specified with a path that is a parent
4122 directory of the first transfer directory, rsync will scan all the par‐
4123 ent dirs from that starting point to the transfer directory for the in‐
4124 dicated per-directory file. For instance, here is a common filter (see
4125 -F):
4126
4127 --filter=': /.rsync-filter'
4128
4129 That rule tells rsync to scan for the file .rsync-filter in all direc‐
4130 tories from the root down through the parent directory of the transfer
4131 prior to the start of the normal directory scan of the file in the di‐
4132 rectories that are sent as a part of the transfer. (Note: for an rsync
4133 daemon, the root is always the same as the module's "path".)
4134
4135 Some examples of this pre-scanning for per-directory files:
4136
4137 rsync -avF /src/path/ /dest/dir
4138 rsync -av --filter=': ../../.rsync-filter' /src/path/ /dest/dir
4139 rsync -av --filter=': .rsync-filter' /src/path/ /dest/dir
4140
4141 The first two commands above will look for ".rsync-filter" in "/" and
4142 "/src" before the normal scan begins looking for the file in
4143 "/src/path" and its subdirectories. The last command avoids the par‐
4144 ent-dir scan and only looks for the ".rsync-filter" files in each di‐
4145 rectory that is a part of the transfer.
4146
4147 If you want to include the contents of a ".cvsignore" in your patterns,
4148 you should use the rule ":C", which creates a dir-merge of the .cvsig‐
4149 nore file, but parsed in a CVS-compatible manner. You can use this to
4150 affect where the --cvs-exclude (-C) option's inclusion of the per-di‐
4151 rectory .cvsignore file gets placed into your rules by putting the ":C"
4152 wherever you like in your filter rules. Without this, rsync would add
4153 the dir-merge rule for the .cvsignore file at the end of all your other
4154 rules (giving it a lower priority than your command-line rules). For
4155 example:
4156
4157 cat <<EOT | rsync -avC --filter='. -' a/ b
4158 + foo.o
4159 :C
4160 - *.old
4161 EOT
4162 rsync -avC --include=foo.o -f :C --exclude='*.old' a/ b
4163
4164 Both of the above rsync commands are identical. Each one will merge
4165 all the per-directory .cvsignore rules in the middle of the list rather
4166 than at the end. This allows their dir-specific rules to supersede the
4167 rules that follow the :C instead of being subservient to all your
4168 rules. To affect the other CVS exclude rules (i.e. the default list of
4169 exclusions, the contents of $HOME/.cvsignore, and the value of $CVSIG‐
4170 NORE) you should omit the -C command-line option and instead insert a
4171 "-C" rule into your filter rules; e.g. "--filter=-C".
4172
4174 You can clear the current include/exclude list by using the "!" filter
4175 rule (as introduced in the FILTER RULES section above). The "current"
4176 list is either the global list of rules (if the rule is encountered
4177 while parsing the filter options) or a set of per-directory rules
4178 (which are inherited in their own sub-list, so a subdirectory can use
4179 this to clear out the parent's rules).
4180
4182 As mentioned earlier, global include/exclude patterns are anchored at
4183 the "root of the transfer" (as opposed to per-directory patterns, which
4184 are anchored at the merge-file's directory). If you think of the
4185 transfer as a subtree of names that are being sent from sender to re‐
4186 ceiver, the transfer-root is where the tree starts to be duplicated in
4187 the destination directory. This root governs where patterns that start
4188 with a / match.
4189
4190 Because the matching is relative to the transfer-root, changing the
4191 trailing slash on a source path or changing your use of the --relative
4192 option affects the path you need to use in your matching (in addition
4193 to changing how much of the file tree is duplicated on the destination
4194 host). The following examples demonstrate this.
4195
4196 Let's say that we want to match two source files, one with an absolute
4197 path of "/home/me/foo/bar", and one with a path of "/home/you/bar/baz".
4198 Here is how the various command choices differ for a 2-source transfer:
4199
4200 Example cmd: rsync -a /home/me /home/you /dest
4201 +/- pattern: /me/foo/bar
4202 +/- pattern: /you/bar/baz
4203 Target file: /dest/me/foo/bar
4204 Target file: /dest/you/bar/baz
4205
4206 Example cmd: rsync -a /home/me/ /home/you/ /dest
4207 +/- pattern: /foo/bar (note missing "me")
4208 +/- pattern: /bar/baz (note missing "you")
4209 Target file: /dest/foo/bar
4210 Target file: /dest/bar/baz
4211
4212 Example cmd: rsync -a --relative /home/me/ /home/you /dest
4213 +/- pattern: /home/me/foo/bar (note full path)
4214 +/- pattern: /home/you/bar/baz (ditto)
4215 Target file: /dest/home/me/foo/bar
4216 Target file: /dest/home/you/bar/baz
4217
4218 Example cmd: cd /home; rsync -a --relative me/foo you/ /dest
4219 +/- pattern: /me/foo/bar (starts at specified path)
4220 +/- pattern: /you/bar/baz (ditto)
4221 Target file: /dest/me/foo/bar
4222 Target file: /dest/you/bar/baz
4223
4224 The easiest way to see what name you should filter is to just look at
4225 the output when using --verbose and put a / in front of the name (use
4226 the --dry-run option if you're not yet ready to copy any files).
4227
4229 Without a delete option, per-directory rules are only relevant on the
4230 sending side, so you can feel free to exclude the merge files them‐
4231 selves without affecting the transfer. To make this easy, the 'e' mod‐
4232 ifier adds this exclude for you, as seen in these two equivalent com‐
4233 mands:
4234
4235 rsync -av --filter=': .excl' --exclude=.excl host:src/dir /dest
4236 rsync -av --filter=':e .excl' host:src/dir /dest
4237
4238 However, if you want to do a delete on the receiving side AND you want
4239 some files to be excluded from being deleted, you'll need to be sure
4240 that the receiving side knows what files to exclude. The easiest way
4241 is to include the per-directory merge files in the transfer and use
4242 --delete-after, because this ensures that the receiving side gets all
4243 the same exclude rules as the sending side before it tries to delete
4244 anything:
4245
4246 rsync -avF --delete-after host:src/dir /dest
4247
4248 However, if the merge files are not a part of the transfer, you'll need
4249 to either specify some global exclude rules (i.e. specified on the com‐
4250 mand line), or you'll need to maintain your own per-directory merge
4251 files on the receiving side. An example of the first is this (assume
4252 that the remote .rules files exclude themselves):
4253
4254 rsync -av --filter=': .rules' --filter='. /my/extra.rules'
4255 --delete host:src/dir /dest
4256
4257 In the above example the extra.rules file can affect both sides of the
4258 transfer, but (on the sending side) the rules are subservient to the
4259 rules merged from the .rules files because they were specified after
4260 the per-directory merge rule.
4261
4262 In one final example, the remote side is excluding the .rsync-filter
4263 files from the transfer, but we want to use our own .rsync-filter files
4264 to control what gets deleted on the receiving side. To do this we must
4265 specifically exclude the per-directory merge files (so that they don't
4266 get deleted) and then put rules into the local files to control what
4267 else should not get deleted. Like one of these commands:
4268
4269 rsync -av --filter=':e /.rsync-filter' --delete \
4270 host:src/dir /dest
4271 rsync -avFF --delete host:src/dir /dest
4272
4274 Batch mode can be used to apply the same set of updates to many identi‐
4275 cal systems. Suppose one has a tree which is replicated on a number of
4276 hosts. Now suppose some changes have been made to this source tree and
4277 those changes need to be propagated to the other hosts. In order to do
4278 this using batch mode, rsync is run with the write-batch option to ap‐
4279 ply the changes made to the source tree to one of the destination
4280 trees. The write-batch option causes the rsync client to store in a
4281 "batch file" all the information needed to repeat this operation
4282 against other, identical destination trees.
4283
4284 Generating the batch file once saves having to perform the file status,
4285 checksum, and data block generation more than once when updating multi‐
4286 ple destination trees. Multicast transport protocols can be used to
4287 transfer the batch update files in parallel to many hosts at once, in‐
4288 stead of sending the same data to every host individually.
4289
4290 To apply the recorded changes to another destination tree, run rsync
4291 with the read-batch option, specifying the name of the same batch file,
4292 and the destination tree. Rsync updates the destination tree using the
4293 information stored in the batch file.
4294
4295 For your convenience, a script file is also created when the write-
4296 batch option is used: it will be named the same as the batch file with
4297 ".sh" appended. This script file contains a command-line suitable for
4298 updating a destination tree using the associated batch file. It can be
4299 executed using a Bourne (or Bourne-like) shell, optionally passing in
4300 an alternate destination tree pathname which is then used instead of
4301 the original destination path. This is useful when the destination
4302 tree path on the current host differs from the one used to create the
4303 batch file.
4304
4305 Examples:
4306
4307 $ rsync --write-batch=foo -a host:/source/dir/ /adest/dir/
4308 $ scp foo* remote:
4309 $ ssh remote ./foo.sh /bdest/dir/
4310
4311 $ rsync --write-batch=foo -a /source/dir/ /adest/dir/
4312 $ ssh remote rsync --read-batch=- -a /bdest/dir/ <foo
4313
4314 In these examples, rsync is used to update /adest/dir/ from
4315 /source/dir/ and the information to repeat this operation is stored in
4316 "foo" and "foo.sh". The host "remote" is then updated with the batched
4317 data going into the directory /bdest/dir. The differences between the
4318 two examples reveals some of the flexibility you have in how you deal
4319 with batches:
4320
4321 o The first example shows that the initial copy doesn't have to be
4322 local -- you can push or pull data to/from a remote host using
4323 either the remote-shell syntax or rsync daemon syntax, as de‐
4324 sired.
4325
4326 o The first example uses the created "foo.sh" file to get the
4327 right rsync options when running the read-batch command on the
4328 remote host.
4329
4330 o The second example reads the batch data via standard input so
4331 that the batch file doesn't need to be copied to the remote ma‐
4332 chine first. This example avoids the foo.sh script because it
4333 needed to use a modified --read-batch option, but you could edit
4334 the script file if you wished to make use of it (just be sure
4335 that no other option is trying to use standard input, such as
4336 the --exclude-from=- option).
4337
4338 Caveats:
4339
4340 The read-batch option expects the destination tree that it is updating
4341 to be identical to the destination tree that was used to create the
4342 batch update fileset. When a difference between the destination trees
4343 is encountered the update might be discarded with a warning (if the
4344 file appears to be up-to-date already) or the file-update may be at‐
4345 tempted and then, if the file fails to verify, the update discarded
4346 with an error. This means that it should be safe to re-run a read-
4347 batch operation if the command got interrupted. If you wish to force
4348 the batched-update to always be attempted regardless of the file's size
4349 and date, use the -I option (when reading the batch). If an error oc‐
4350 curs, the destination tree will probably be in a partially updated
4351 state. In that case, rsync can be used in its regular (non-batch) mode
4352 of operation to fix up the destination tree.
4353
4354 The rsync version used on all destinations must be at least as new as
4355 the one used to generate the batch file. Rsync will die with an error
4356 if the protocol version in the batch file is too new for the batch-
4357 reading rsync to handle. See also the --protocol option for a way to
4358 have the creating rsync generate a batch file that an older rsync can
4359 understand. (Note that batch files changed format in version 2.6.3, so
4360 mixing versions older than that with newer versions will not work.)
4361
4362 When reading a batch file, rsync will force the value of certain op‐
4363 tions to match the data in the batch file if you didn't set them to the
4364 same as the batch-writing command. Other options can (and should) be
4365 changed. For instance --write-batch changes to --read-batch, --files-
4366 from is dropped, and the --filter / --include / --exclude options are
4367 not needed unless one of the --delete options is specified.
4368
4369 The code that creates the BATCH.sh file transforms any filter/in‐
4370 clude/exclude options into a single list that is appended as a "here"
4371 document to the shell script file. An advanced user can use this to
4372 modify the exclude list if a change in what gets deleted by --delete is
4373 desired. A normal user can ignore this detail and just use the shell
4374 script as an easy way to run the appropriate --read-batch command for
4375 the batched data.
4376
4377 The original batch mode in rsync was based on "rsync+", but the latest
4378 version uses a new implementation.
4379
4381 Three basic behaviors are possible when rsync encounters a symbolic
4382 link in the source directory.
4383
4384 By default, symbolic links are not transferred at all. A message
4385 "skipping non-regular" file is emitted for any symlinks that exist.
4386
4387 If --links is specified, then symlinks are added to the transfer (in‐
4388 stead of being noisily ignored), and the default handling is to recre‐
4389 ate them with the same target on the destination. Note that --archive
4390 implies --links.
4391
4392 If --copy-links is specified, then symlinks are "collapsed" by copying
4393 their referent, rather than the symlink.
4394
4395 Rsync can also distinguish "safe" and "unsafe" symbolic links. An ex‐
4396 ample where this might be used is a web site mirror that wishes to en‐
4397 sure that the rsync module that is copied does not include symbolic
4398 links to /etc/passwd in the public section of the site. Using --copy-
4399 unsafe-links will cause any links to be copied as the file they point
4400 to on the destination. Using --safe-links will cause unsafe links to
4401 be omitted by the receiver. (Note that you must specify or imply
4402 --links for --safe-links to have any effect.)
4403
4404 Symbolic links are considered unsafe if they are absolute symlinks
4405 (start with /), empty, or if they contain enough ".." components to as‐
4406 cend from the top of the transfer.
4407
4408 Here's a summary of how the symlink options are interpreted. The list
4409 is in order of precedence, so if your combination of options isn't men‐
4410 tioned, use the first line that is a complete subset of your options:
4411
4412 --copy-links
4413 Turn all symlinks into normal files and directories (leaving no
4414 symlinks in the transfer for any other options to affect).
4415
4416 --copy-dirlinks
4417 Turn just symlinks to directories into real directories, leaving
4418 all other symlinks to be handled as described below.
4419
4420 --links --copy-unsafe-links
4421 Turn all unsafe symlinks into files and create all safe sym‐
4422 links.
4423
4424 --copy-unsafe-links
4425 Turn all unsafe symlinks into files, noisily skip all safe sym‐
4426 links.
4427
4428 --links --safe-links
4429 The receiver skips creating unsafe symlinks found in the trans‐
4430 fer and creates the safe ones.
4431
4432 --links
4433 Create all symlinks.
4434
4435 For the effect of --munge-links, see the discussion in that option's
4436 section.
4437
4438 Note that the --keep-dirlinks option does not effect symlinks in the
4439 transfer but instead affects how rsync treats a symlink to a directory
4440 that already exists on the receiving side. See that option's section
4441 for a warning.
4442
4444 Rsync occasionally produces error messages that may seem a little cryp‐
4445 tic. The one that seems to cause the most confusion is "protocol ver‐
4446 sion mismatch -- is your shell clean?".
4447
4448 This message is usually caused by your startup scripts or remote shell
4449 facility producing unwanted garbage on the stream that rsync is using
4450 for its transport. The way to diagnose this problem is to run your re‐
4451 mote shell like this:
4452
4453 ssh remotehost /bin/true > out.dat
4454
4455 then look at out.dat. If everything is working correctly then out.dat
4456 should be a zero length file. If you are getting the above error from
4457 rsync then you will probably find that out.dat contains some text or
4458 data. Look at the contents and try to work out what is producing it.
4459 The most common cause is incorrectly configured shell startup scripts
4460 (such as .cshrc or .profile) that contain output statements for non-in‐
4461 teractive logins.
4462
4463 If you are having trouble debugging filter patterns, then try specify‐
4464 ing the -vv option. At this level of verbosity rsync will show why
4465 each individual file is included or excluded.
4466
4468 o 0 - Success
4469
4470 o 1 - Syntax or usage error
4471
4472 o 2 - Protocol incompatibility
4473
4474 o 3 - Errors selecting input/output files, dirs
4475
4476 o
4477
4478 o 4 - Requested action not supported. Either:
4479
4480 an attempt was made to manipulate 64-bit files on a plat‐
4481 form that cannot support them
4482
4483 o an option was specified that is supported by the client
4484 and not by the server
4485
4486 o 5 - Error starting client-server protocol
4487
4488 o 6 - Daemon unable to append to log-file
4489
4490 o 10 - Error in socket I/O
4491
4492 o 11 - Error in file I/O
4493
4494 o 12 - Error in rsync protocol data stream
4495
4496 o 13 - Errors with program diagnostics
4497
4498 o 14 - Error in IPC code
4499
4500 o 20 - Received SIGUSR1 or SIGINT
4501
4502 o 21 - Some error returned by waitpid()
4503
4504 o 22 - Error allocating core memory buffers
4505
4506 o 23 - Partial transfer due to error
4507
4508 o 24 - Partial transfer due to vanished source files
4509
4510 o 25 - The --max-delete limit stopped deletions
4511
4512 o 30 - Timeout in data send/receive
4513
4514 o 35 - Timeout waiting for daemon connection
4515
4517 CVSIGNORE
4518 The CVSIGNORE environment variable supplements any ignore pat‐
4519 terns in .cvsignore files. See the --cvs-exclude option for
4520 more details.
4521
4522 RSYNC_ICONV
4523 Specify a default --iconv setting using this environment vari‐
4524 able. First supported in 3.0.0.
4525
4526 RSYNC_OLD_ARGS
4527 Specify a "1" if you want the --old-args option to be enabled by
4528 default, a "2" (or more) if you want it to be enabled in the re‐
4529 peated-option state, or a "0" to make sure that it is disabled
4530 by default. When this environment variable is set to a non-zero
4531 value, it supersedes the RSYNC_PROTECT_ARGS variable.
4532
4533 This variable is ignored if --old-args, --no-old-args, or --pro‐
4534 tect-args is specified on the command line.
4535
4536 First supported in 3.2.4.
4537
4538 RSYNC_PROTECT_ARGS
4539 Specify a non-zero numeric value if you want the --protect-args
4540 option to be enabled by default, or a zero value to make sure
4541 that it is disabled by default.
4542
4543 This variable is ignored if --protect-args, --no-protect-args,
4544 or --old-args is specified on the command line.
4545
4546 First supported in 3.1.0. Starting in 3.2.4, this variable is
4547 ignored if RSYNC_OLD_ARGS is set to a non-zero value.
4548
4549 RSYNC_RSH
4550 This environment variable allows you to override the default
4551 shell used as the transport for rsync. Command line options are
4552 permitted after the command name, just as in the --rsh (-e) op‐
4553 tion.
4554
4555 RSYNC_PROXY
4556 This environment variable allows you to redirect your rsync
4557 client to use a web proxy when connecting to an rsync daemon.
4558 You should set RSYNC_PROXY to a hostname:port pair.
4559
4560 RSYNC_PASSWORD
4561 This environment variable allows you to set the password for an
4562 rsync daemon connection, which avoids the password prompt. Note
4563 that this does not supply a password to a remote shell transport
4564 such as ssh (consult its documentation for how to do that).
4565
4566 USER or LOGNAME
4567 The USER or LOGNAME environment variables are used to determine
4568 the default username sent to an rsync daemon. If neither is
4569 set, the username defaults to "nobody". If both are set, USER
4570 takes precedence.
4571
4572 RSYNC_PARTIAL_DIR
4573 This environment variable specifies the directory to use for a
4574 --partial transfer without implying that partial transfers be
4575 enabled. See the --partial-dir option for full details.
4576
4577 RSYNC_COMPRESS_LIST
4578 This environment variable allows you to customize the negotia‐
4579 tion of the compression algorithm by specifying an alternate or‐
4580 der or a reduced list of names. Use the command rsync --version
4581 to see the available compression names. See the --compress op‐
4582 tion for full details.
4583
4584 RSYNC_CHECKSUM_LIST
4585 This environment variable allows you to customize the negotia‐
4586 tion of the checksum algorithm by specifying an alternate order
4587 or a reduced list of names. Use the command rsync --version to
4588 see the available checksum names. See the --checksum-choice op‐
4589 tion for full details.
4590
4591 RSYNC_MAX_ALLOC
4592 This environment variable sets an allocation maximum as if you
4593 had used the --max-alloc option.
4594
4595 RSYNC_PORT
4596 This environment variable is not read by rsync, but is instead
4597 set in its sub-environment when rsync is running the remote
4598 shell in combination with a daemon connection. This allows a
4599 script such as rsync-ssl to be able to know the port number that
4600 the user specified on the command line.
4601
4602 HOME This environment variable is used to find the user's default
4603 .cvsignore file.
4604
4605 RSYNC_CONNECT_PROG
4606 This environment variable is mainly used in debug setups to set
4607 the program to use when making a daemon connection. See CON‐
4608 NECTING TO AN RSYNC DAEMON for full details.
4609
4610 RSYNC_SHELL
4611 This environment variable is mainly used in debug setups to set
4612 the program to use to run the program specified by [RSYNC_CON‐
4613 NECT_PROG]. See CONNECTING TO AN RSYNC DAEMON for full details.
4614
4616 /etc/rsyncd.conf or rsyncd.conf
4617
4619 rsync-ssl(1), rsyncd.conf(5), rrsync(1)
4620
4622 o Times are transferred as *nix time_t values.
4623
4624 o When transferring to FAT filesystems rsync may re-sync unmodi‐
4625 fied files. See the comments on the --modify-window option.
4626
4627 o File permissions, devices, etc. are transferred as native numer‐
4628 ical values.
4629
4630 o See also the comments on the --delete option.
4631
4632 Please report bugs! See the web site at https://rsync.samba.org/.
4633
4635 This manpage is current for version 3.2.4 of rsync.
4636
4638 The options --server and --sender are used internally by rsync, and
4639 should never be typed by a user under normal circumstances. Some
4640 awareness of these options may be needed in certain scenarios, such as
4641 when setting up a login that can only run an rsync command. For in‐
4642 stance, the support directory of the rsync distribution has an example
4643 script named rrsync (for restricted rsync) that can be used with a re‐
4644 stricted ssh login.
4645
4647 Rsync is distributed under the GNU General Public License. See the
4648 file COPYING for details.
4649
4650 An rsync web site is available at https://rsync.samba.org/. The site
4651 includes an FAQ-O-Matic which may cover questions unanswered by this
4652 manual page.
4653
4654 The rsync github project is https://github.com/WayneD/rsync.
4655
4656 We would be delighted to hear from you if you like this program.
4657 Please contact the mailing-list at rsync@lists.samba.org.
4658
4659 This program uses the excellent zlib compression library written by
4660 Jean-loup Gailly and Mark Adler.
4661
4663 Special thanks go out to: John Van Essen, Matt McCutchen, Wesley W.
4664 Terpstra, David Dykstra, Jos Backus, Sebastian Krahmer, Martin Pool,
4665 and our gone-but-not-forgotten compadre, J.W. Schultz.
4666
4667 Thanks also to Richard Brent, Brendan Mackay, Bill Waite, Stephen Roth‐
4668 well and David Bell. I've probably missed some people, my apologies if
4669 I have.
4670
4672 Rsync was originally written by Andrew Tridgell and Paul Mackerras.
4673 Many people have later contributed to it. It is currently maintained by
4674 Wayne Davison.
4675
4676 Mailing lists for support and development are available at
4677 https://lists.samba.org/.
4678
4679
4680
4681rsync 3.2.4 15 Apr 2022 rsync(1)