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