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