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