1rsync(1) rsync(1)
2
3
4
6 rsync - faster, flexible replacement for rcp
7
9 rsync [OPTION]... SRC [SRC]... DEST
10
11 rsync [OPTION]... SRC [SRC]... [USER@]HOST:DEST
12
13 rsync [OPTION]... SRC [SRC]... [USER@]HOST::DEST
14
15 rsync [OPTION]... SRC [SRC]... rsync://[USER@]HOST[:PORT]/DEST
16
17 rsync [OPTION]... SRC
18
19 rsync [OPTION]... [USER@]HOST:SRC [DEST]
20
21 rsync [OPTION]... [USER@]HOST::SRC [DEST]
22
23 rsync [OPTION]... rsync://[USER@]HOST[:PORT]/SRC [DEST]
24
26 rsync is a program that behaves in much the same way that rcp does, but
27 has many more options and uses the rsync remote-update protocol to
28 greatly speed up file transfers when the destination file is being
29 updated.
30
31 The rsync remote-update protocol allows rsync to transfer just the dif‐
32 ferences between two sets of files across the network connection, using
33 an efficient checksum-search algorithm described in the technical
34 report that accompanies this package.
35
36 Some of the additional features of rsync are:
37
38 o support for copying links, devices, owners, groups, and permis‐
39 sions
40
41 o exclude and exclude-from options similar to GNU tar
42
43 o a CVS exclude mode for ignoring the same files that CVS would
44 ignore
45
46 o can use any transparent remote shell, including ssh or rsh
47
48 o does not require super-user privileges
49
50 o pipelining of file transfers to minimize latency costs
51
52 o support for anonymous or authenticated rsync daemons (ideal for
53 mirroring)
54
55
57 Rsync copies files either to or from a remote host, or locally on the
58 current host (it does not support copying files between two remote
59 hosts).
60
61 There are two different ways for rsync to contact a remote system:
62 using a remote-shell program as the transport (such as ssh or rsh) or
63 contacting an rsync daemon directly via TCP. The remote-shell trans‐
64 port is used whenever the source or destination path contains a single
65 colon (:) separator after a host specification. Contacting an rsync
66 daemon directly happens when the source or destination path contains a
67 double colon (::) separator after a host specification, OR when an
68 rsync:// URL is specified (see also the "USING RSYNC-DAEMON FEATURES
69 VIA A REMOTE-SHELL CONNECTION" section for an exception to this latter
70 rule).
71
72 As a special case, if a single source arg is specified without a desti‐
73 nation, the files are listed in an output format similar to "ls -l".
74
75 As expected, if neither the source or destination path specify a remote
76 host, the copy occurs locally (see also the --list-only option).
77
79 See the file README for installation instructions.
80
81 Once installed, you can use rsync to any machine that you can access
82 via a remote shell (as well as some that you can access using the rsync
83 daemon-mode protocol). For remote transfers, a modern rsync uses ssh
84 for its communications, but it may have been configured to use a dif‐
85 ferent remote shell by default, such as rsh or remsh.
86
87 You can also specify any remote shell you like, either by using the -e
88 command line option, or by setting the RSYNC_RSH environment variable.
89
90 Note that rsync must be installed on both the source and destination
91 machines.
92
94 You use rsync in the same way you use rcp. You must specify a source
95 and a destination, one of which may be remote.
96
97 Perhaps the best way to explain the syntax is with some examples:
98
99 rsync -t *.c foo:src/
100
101
102 This would transfer all files matching the pattern *.c from the current
103 directory to the directory src on the machine foo. If any of the files
104 already exist on the remote system then the rsync remote-update proto‐
105 col is used to update the file by sending only the differences. See the
106 tech report for details.
107
108 rsync -avz foo:src/bar /data/tmp
109
110
111 This would recursively transfer all files from the directory src/bar on
112 the machine foo into the /data/tmp/bar directory on the local machine.
113 The files are transferred in "archive" mode, which ensures that sym‐
114 bolic links, devices, attributes, permissions, ownerships, etc. are
115 preserved in the transfer. Additionally, compression will be used to
116 reduce the size of data portions of the transfer.
117
118 rsync -avz foo:src/bar/ /data/tmp
119
120
121 A trailing slash on the source changes this behavior to avoid creating
122 an additional directory level at the destination. You can think of a
123 trailing / on a source as meaning "copy the contents of this directory"
124 as opposed to "copy the directory by name", but in both cases the
125 attributes of the containing directory are transferred to the contain‐
126 ing directory on the destination. In other words, each of the follow‐
127 ing commands copies the files in the same way, including their setting
128 of the attributes of /dest/foo:
129
130 rsync -av /src/foo /dest
131 rsync -av /src/foo/ /dest/foo
132
133
134 Note also that host and module references don't require a trailing
135 slash to copy the contents of the default directory. For example, both
136 of these copy the remote directory's contents into "/dest":
137
138 rsync -av host: /dest
139 rsync -av host::module /dest
140
141
142 You can also use rsync in local-only mode, where both the source and
143 destination don't have a ':' in the name. In this case it behaves like
144 an improved copy command.
145
146 Finally, you can list all the (listable) modules available from a par‐
147 ticular rsync daemon by leaving off the module name:
148
149 rsync somehost.mydomain.com::
150
151
152 See the following section for more details.
153
155 The syntax for requesting multiple files from a remote host involves
156 using quoted spaces in the SRC. Some examples:
157
158 rsync host::'modname/dir1/file1 modname/dir2/file2' /dest
159
160
161 This would copy file1 and file2 into /dest from an rsync daemon. Each
162 additional arg must include the same "modname/" prefix as the first
163 one, and must be preceded by a single space. All other spaces are
164 assumed to be a part of the filenames.
165
166 rsync -av host:'dir1/file1 dir2/file2' /dest
167
168
169 This would copy file1 and file2 into /dest using a remote shell. This
170 word-splitting is done by the remote shell, so if it doesn't work it
171 means that the remote shell isn't configured to split its args based on
172 whitespace (a very rare setting, but not unknown). If you need to
173 transfer a filename that contains whitespace, you'll need to either
174 escape the whitespace in a way that the remote shell will understand,
175 or use wildcards in place of the spaces. Two examples of this are:
176
177 rsync -av host:'file\ name\ with\ spaces' /dest
178 rsync -av host:file?name?with?spaces /dest
179
180
181 This latter example assumes that your shell passes through unmatched
182 wildcards. If it complains about "no match", put the name in quotes.
183
185 It is also possible to use rsync without a remote shell as the trans‐
186 port. In this case you will directly connect to a remote rsync daemon,
187 typically using TCP port 873. (This obviously requires the daemon to
188 be running on the remote system, so refer to the STARTING AN RSYNC DAE‐
189 MON TO ACCEPT CONNECTIONS section below for information on that.)
190
191 Using rsync in this way is the same as using it with a remote shell
192 except that:
193
194 o you either use a double colon :: instead of a single colon to
195 separate the hostname from the path, or you use an rsync:// URL.
196
197 o the first word of the "path" is actually a module name.
198
199 o the remote daemon may print a message of the day when you con‐
200 nect.
201
202 o if you specify no path name on the remote daemon then the list
203 of accessible paths on the daemon will be shown.
204
205 o if you specify no local destination then a listing of the speci‐
206 fied files on the remote daemon is provided.
207
208 o you must not specify the --rsh (-e) option.
209
210
211 An example that copies all the files in a remote module named "src":
212
213 rsync -av host::src /dest
214
215
216 Some modules on the remote daemon may require authentication. If so,
217 you will receive a password prompt when you connect. You can avoid the
218 password prompt by setting the environment variable RSYNC_PASSWORD to
219 the password you want to use or using the --password-file option. This
220 may be useful when scripting rsync.
221
222 WARNING: On some systems environment variables are visible to all
223 users. On those systems using --password-file is recommended.
224
225 You may establish the connection via a web proxy by setting the envi‐
226 ronment variable RSYNC_PROXY to a hostname:port pair pointing to your
227 web proxy. Note that your web proxy's configuration must support proxy
228 connections to port 873.
229
231 It is sometimes useful to use various features of an rsync daemon (such
232 as named modules) without actually allowing any new socket connections
233 into a system (other than what is already required to allow remote-
234 shell access). Rsync supports connecting to a host using a remote
235 shell and then spawning a single-use "daemon" server that expects to
236 read its config file in the home dir of the remote user. This can be
237 useful if you want to encrypt a daemon-style transfer's data, but since
238 the daemon is started up fresh by the remote user, you may not be able
239 to use features such as chroot or change the uid used by the daemon.
240 (For another way to encrypt a daemon transfer, consider using ssh to
241 tunnel a local port to a remote machine and configure a normal rsync
242 daemon on that remote host to only allow connections from "localhost".)
243
244 From the user's perspective, a daemon transfer via a remote-shell con‐
245 nection uses nearly the same command-line syntax as a normal rsync-dae‐
246 mon transfer, with the only exception being that you must explicitly
247 set the remote shell program on the command-line with the --rsh=COMMAND
248 option. (Setting the RSYNC_RSH in the environment will not turn on
249 this functionality.) For example:
250
251 rsync -av --rsh=ssh host::module /dest
252
253
254 If you need to specify a different remote-shell user, keep in mind that
255 the user@ prefix in front of the host is specifying the rsync-user
256 value (for a module that requires user-based authentication). This
257 means that you must give the '-l user' option to ssh when specifying
258 the remote-shell, as in this example that uses the short version of the
259 --rsh option:
260
261 rsync -av -e "ssh -l ssh-user" rsync-user@host::module /dest
262
263
264 The "ssh-user" will be used at the ssh level; the "rsync-user" will be
265 used to log-in to the "module".
266
268 In order to connect to an rsync daemon, the remote system needs to have
269 a daemon already running (or it needs to have configured something like
270 inetd to spawn an rsync daemon for incoming connections on a particular
271 port). For full information on how to start a daemon that will han‐
272 dling incoming socket connections, see the rsyncd.conf(5) man page --
273 that is the config file for the daemon, and it contains the full
274 details for how to run the daemon (including stand-alone and inetd con‐
275 figurations).
276
277 If you're using one of the remote-shell transports for the transfer,
278 there is no need to manually start an rsync daemon.
279
281 Here are some examples of how I use rsync.
282
283 To backup my wife's home directory, which consists of large MS Word
284 files and mail folders, I use a cron job that runs
285
286 rsync -Cavz . arvidsjaur:backup
287
288
289 each night over a PPP connection to a duplicate directory on my machine
290 "arvidsjaur".
291
292 To synchronize my samba source trees I use the following Makefile tar‐
293 gets:
294
295 get:
296 rsync -avuzb --exclude '*~' samba:samba/ .
297 put:
298 rsync -Cavuzb . samba:samba/
299 sync: get put
300
301
302 this allows me to sync with a CVS directory at the other end of the
303 connection. I then do CVS operations on the remote machine, which saves
304 a lot of time as the remote CVS protocol isn't very efficient.
305
306 I mirror a directory between my "old" and "new" ftp sites with the com‐
307 mand:
308
309 rsync -az -e ssh --delete ~ftp/pub/samba nimbus:"~ftp/pub/tridge"
310
311 This is launched from cron every few hours.
312
314 Here is a short summary of the options available in rsync. Please refer
315 to the detailed description below for a complete description.
316
317 -v, --verbose increase verbosity
318 -q, --quiet suppress non-error messages
319 --no-motd suppress daemon-mode MOTD (see caveat)
320 -c, --checksum skip based on checksum, not mod-time & size
321 -a, --archive archive mode; equals -rlptgoD (no -H,-A,-X)
322 --no-OPTION turn off an implied OPTION (e.g. --no-D)
323 -r, --recursive recurse into directories
324 -R, --relative use relative path names
325 --no-implied-dirs don't send implied dirs with --relative
326 -b, --backup make backups (see --suffix & --backup-dir)
327 --backup-dir=DIR make backups into hierarchy based in DIR
328 --suffix=SUFFIX backup suffix (default ~ w/o --backup-dir)
329 -u, --update skip files that are newer on the receiver
330 --inplace update destination files in-place
331 --append append data onto shorter files
332 -d, --dirs transfer directories without recursing
333 -l, --links copy symlinks as symlinks
334 -L, --copy-links transform symlink into referent file/dir
335 --copy-unsafe-links only "unsafe" symlinks are transformed
336 --safe-links ignore symlinks that point outside the tree
337 -k, --copy-dirlinks transform symlink to dir into referent dir
338 -K, --keep-dirlinks treat symlinked dir on receiver as dir
339 -H, --hard-links preserve hard links
340 -p, --perms preserve permissions
341 -E, --executability preserve executability
342 --chmod=CHMOD affect file and/or directory permissions
343 -A, --acls preserve ACLs (implies -p) [non-standard]
344 -X, --xattrs preserve extended attrs (implies -p) [n.s.]
345 -o, --owner preserve owner (super-user only)
346 -g, --group preserve group
347 --devices preserve device files (super-user only)
348 --specials preserve special files
349 -D same as --devices --specials
350 -t, --times preserve times
351 -O, --omit-dir-times omit directories when preserving times
352 --super receiver attempts super-user activities
353 -S, --sparse handle sparse files efficiently
354 -n, --dry-run show what would have been transferred
355 -W, --whole-file copy files whole (without rsync algorithm)
356 -x, --one-file-system don't cross filesystem boundaries
357 -B, --block-size=SIZE force a fixed checksum block-size
358 -e, --rsh=COMMAND specify the remote shell to use
359 --rsync-path=PROGRAM specify the rsync to run on remote machine
360 --existing skip creating new files on receiver
361 --ignore-existing skip updating files that exist on receiver
362 --remove-source-files sender removes synchronized files (non-dir)
363 --del an alias for --delete-during
364 --delete delete extraneous files from dest dirs
365 --delete-before receiver deletes before transfer (default)
366 --delete-during receiver deletes during xfer, not before
367 --delete-after receiver deletes after transfer, not before
368 --delete-excluded also delete excluded files from dest dirs
369 --ignore-errors delete even if there are I/O errors
370 --force force deletion of dirs even if not empty
371 --max-delete=NUM don't delete more than NUM files
372 --max-size=SIZE don't transfer any file larger than SIZE
373 --min-size=SIZE don't transfer any file smaller than SIZE
374 --partial keep partially transferred files
375 --partial-dir=DIR put a partially transferred file into DIR
376 --delay-updates put all updated files into place at end
377 -m, --prune-empty-dirs prune empty directory chains from file-list
378 --numeric-ids don't map uid/gid values by user/group name
379 --timeout=TIME set I/O timeout in seconds
380 -I, --ignore-times don't skip files that match size and time
381 --size-only skip files that match in size
382 --modify-window=NUM compare mod-times with reduced accuracy
383 -T, --temp-dir=DIR create temporary files in directory DIR
384 -y, --fuzzy find similar file for basis if no dest file
385 --compare-dest=DIR also compare received files relative to DIR
386 --copy-dest=DIR ... and include copies of unchanged files
387 --link-dest=DIR hardlink to files in DIR when unchanged
388 -z, --compress compress file data during the transfer
389 --compress-level=NUM explicitly set compression level
390 -C, --cvs-exclude auto-ignore files in the same way CVS does
391 -f, --filter=RULE add a file-filtering RULE
392 -F same as --filter='dir-merge /.rsync-filter'
393 repeated: --filter='- .rsync-filter'
394 --exclude=PATTERN exclude files matching PATTERN
395 --exclude-from=FILE read exclude patterns from FILE
396 --include=PATTERN don't exclude files matching PATTERN
397 --include-from=FILE read include patterns from FILE
398 --files-from=FILE read list of source-file names from FILE
399 -0, --from0 all *from/filter files are delimited by 0s
400 --address=ADDRESS bind address for outgoing socket to daemon
401 --port=PORT specify double-colon alternate port number
402 --sockopts=OPTIONS specify custom TCP options
403 --blocking-io use blocking I/O for the remote shell
404 --stats give some file-transfer stats
405 -8, --8-bit-output leave high-bit chars unescaped in output
406 -h, --human-readable output numbers in a human-readable format
407 --progress show progress during transfer
408 -P same as --partial --progress
409 -i, --itemize-changes output a change-summary for all updates
410 --out-format=FORMAT output updates using the specified FORMAT
411 --log-file=FILE log what we're doing to the specified FILE
412 --log-file-format=FMT log updates using the specified FMT
413 --password-file=FILE read password from FILE
414 --list-only list the files instead of copying them
415 --bwlimit=KBPS limit I/O bandwidth; KBytes per second
416 --write-batch=FILE write a batched update to FILE
417 --only-write-batch=FILE like --write-batch but w/o updating dest
418 --read-batch=FILE read a batched update from FILE
419 --protocol=NUM force an older protocol version to be used
420 --checksum-seed=NUM set block/file checksum seed (advanced)
421 -4, --ipv4 prefer IPv4
422 -6, --ipv6 prefer IPv6
423 --version print version number
424 (-h) --help show this help (see below for -h comment)
425
426
427 Rsync can also be run as a daemon, in which case the following options
428 are accepted:
429
430 --daemon run as an rsync daemon
431 --address=ADDRESS bind to the specified address
432 --bwlimit=KBPS limit I/O bandwidth; KBytes per second
433 --config=FILE specify alternate rsyncd.conf file
434 --no-detach do not detach from the parent
435 --port=PORT listen on alternate port number
436 --log-file=FILE override the "log file" setting
437 --log-file-format=FMT override the "log format" setting
438 --sockopts=OPTIONS specify custom TCP options
439 -v, --verbose increase verbosity
440 -4, --ipv4 prefer IPv4
441 -6, --ipv6 prefer IPv6
442 -h, --help show this help (if used after --daemon)
443
444
446 rsync uses the GNU long options package. Many of the command line
447 options have two variants, one short and one long. These are shown
448 below, separated by commas. Some options only have a long variant. The
449 '=' for options that take a parameter is optional; whitespace can be
450 used instead.
451
452 --help Print a short help page describing the options available in
453 rsync and exit. For backward-compatibility with older versions
454 of rsync, the help will also be output if you use the -h option
455 without any other args.
456
457 --version
458 print the rsync version number and exit.
459
460 -v, --verbose
461 This option increases the amount of information you are given
462 during the transfer. By default, rsync works silently. A single
463 -v will give you information about what files are being trans‐
464 ferred and a brief summary at the end. Two -v flags will give
465 you information on what files are being skipped and slightly
466 more information at the end. More than two -v flags should only
467 be used if you are debugging rsync.
468
469 Note that the names of the transferred files that are output are
470 done using a default --out-format of "%n%L", which tells you
471 just the name of the file and, if the item is a link, where it
472 points. At the single -v level of verbosity, this does not men‐
473 tion when a file gets its attributes changed. If you ask for an
474 itemized list of changed attributes (either --itemize-changes or
475 adding "%i" to the --out-format setting), the output (on the
476 client) increases to mention all items that are changed in any
477 way. See the --out-format option for more details.
478
479 -q, --quiet
480 This option decreases the amount of information you are given
481 during the transfer, notably suppressing information messages
482 from the remote server. This flag is useful when invoking rsync
483 from cron.
484
485 --no-motd
486 This option affects the information that is output by the client
487 at the start of a daemon transfer. This suppresses the message-
488 of-the-day (MOTD) text, but it also affects the list of modules
489 that the daemon sends in response to the "rsync host::" request
490 (due to a limitation in the rsync protocol), so omit this option
491 if you want to request the list of modules from the deamon.
492
493 -I, --ignore-times
494 Normally rsync will skip any files that are already the same
495 size and have the same modification time-stamp. This option
496 turns off this "quick check" behavior, causing all files to be
497 updated.
498
499 --size-only
500 Normally rsync will not transfer any files that are already the
501 same size and have the same modification time-stamp. With the
502 --size-only option, files will not be transferred if they have
503 the same size, regardless of timestamp. This is useful when
504 starting to use rsync after using another mirroring system which
505 may not preserve timestamps exactly.
506
507 --modify-window
508 When comparing two timestamps, rsync treats the timestamps as
509 being equal if they differ by no more than the modify-window
510 value. This is normally 0 (for an exact match), but you may
511 find it useful to set this to a larger value in some situations.
512 In particular, when transferring to or from an MS Windows FAT
513 filesystem (which represents times with a 2-second resolution),
514 --modify-window=1 is useful (allowing times to differ by up to 1
515 second).
516
517 -c, --checksum
518 This forces the sender to checksum every regular file using a
519 128-bit MD4 checksum. It does this during the initial file-sys‐
520 tem scan as it builds the list of all available files. The
521 receiver then checksums its version of each file (if it exists
522 and it has the same size as its sender-side counterpart) in
523 order to decide which files need to be updated: files with
524 either a changed size or a changed checksum are selected for
525 transfer. Since this whole-file checksumming of all files on
526 both sides of the connection occurs in addition to the automatic
527 checksum verifications that occur during a file's transfer, this
528 option can be quite slow.
529
530 Note that rsync always verifies that each transferred file was
531 correctly reconstructed on the receiving side by checking its
532 whole-file checksum, but that automatic after-the-transfer veri‐
533 fication has nothing to do with this option's before-the-trans‐
534 fer "Does this file need to be updated?" check.
535
536 -a, --archive
537 This is equivalent to -rlptgoD. It is a quick way of saying you
538 want recursion and want to preserve almost everything (with -H
539 being a notable omission). The only exception to the above
540 equivalence is when --files-from is specified, in which case -r
541 is not implied.
542
543 Note that -a does not preserve hardlinks, because finding multi‐
544 ply-linked files is expensive. You must separately specify -H.
545
546 --no-OPTION
547 You may turn off one or more implied options by prefixing the
548 option name with "no-". Not all options may be prefixed with a
549 "no-": only options that are implied by other options (e.g.
550 --no-D, --no-perms) or have different defaults in various cir‐
551 cumstances (e.g. --no-whole-file, --no-blocking-io, --no-dirs).
552 You may specify either the short or the long option name after
553 the "no-" prefix (e.g. --no-R is the same as --no-relative).
554
555 For example: if you want to use -a (--archive) but don't want -o
556 (--owner), instead of converting -a into -rlptgD, you could
557 specify -a --no-o (or -a --no-owner).
558
559 The order of the options is important: if you specify --no-r
560 -a, the -r option would end up being turned on, the opposite of
561 -a --no-r. Note also that the side-effects of the --files-from
562 option are NOT positional, as it affects the default state of
563 several options and slightly changes the meaning of -a (see the
564 --files-from option for more details).
565
566 -r, --recursive
567 This tells rsync to copy directories recursively. See also
568 --dirs (-d).
569
570 -R, --relative
571 Use relative paths. This means that the full path names speci‐
572 fied on the command line are sent to the server rather than just
573 the last parts of the filenames. This is particularly useful
574 when you want to send several different directories at the same
575 time. For example, if you used this command:
576
577 rsync -av /foo/bar/baz.c remote:/tmp/
578
579
580 ... this would create a file named baz.c in /tmp/ on the remote
581 machine. If instead you used
582
583 rsync -avR /foo/bar/baz.c remote:/tmp/
584
585
586 then a file named /tmp/foo/bar/baz.c would be created on the
587 remote machine -- the full path name is preserved. To limit the
588 amount of path information that is sent, you have a couple
589 options: (1) With a modern rsync on the sending side (beginning
590 with 2.6.7), you can insert a dot and a slash into the source
591 path, like this:
592
593 rsync -avR /foo/./bar/baz.c remote:/tmp/
594
595
596 That would create /tmp/bar/baz.c on the remote machine. (Note
597 that the dot must be followed by a slash, so "/foo/." would not
598 be abbreviated.) (2) For older rsync versions, you would need
599 to use a chdir to limit the source path. For example, when
600 pushing files:
601
602 (cd /foo; rsync -avR bar/baz.c remote:/tmp/)
603
604
605 (Note that the parens put the two commands into a sub-shell, so
606 that the "cd" command doesn't remain in effect for future com‐
607 mands.) If you're pulling files, use this idiom (which doesn't
608 work with an rsync daemon):
609
610 rsync -avR --rsync-path="cd /foo; rsync" \
611 remote:bar/baz.c /tmp/
612
613
614 --no-implied-dirs
615 This option affects the default behavior of the --relative
616 option. When it is specified, the attributes of the implied
617 directories from the source names are not included in the trans‐
618 fer. This means that the corresponding path elements on the
619 destination system are left unchanged if they exist, and any
620 missing implied directories are created with default attributes.
621 This even allows these implied path elements to have big differ‐
622 ences, such as being a symlink to a directory on one side of the
623 transfer, and a real directory on the other side.
624
625 For instance, if a command-line arg or a files-from entry told
626 rsync to transfer the file "path/foo/file", the directories
627 "path" and "path/foo" are implied when --relative is used. If
628 "path/foo" is a symlink to "bar" on the destination system, the
629 receiving rsync would ordinarily delete "path/foo", recreate it
630 as a directory, and receive the file into the new directory.
631 With --no-implied-dirs, the receiving rsync updates
632 "path/foo/file" using the existing path elements, which means
633 that the file ends up being created in "path/bar". Another way
634 to accomplish this link preservation is to use the
635 --keep-dirlinks option (which will also affect symlinks to
636 directories in the rest of the transfer).
637
638 In a similar but opposite scenario, if the transfer of
639 "path/foo/file" is requested and "path/foo" is a symlink on the
640 sending side, running without --no-implied-dirs would cause
641 rsync to transform "path/foo" on the receiving side into an
642 identical symlink, and then attempt to transfer "path/foo/file",
643 which might fail if the duplicated symlink did not point to a
644 directory on the receiving side. Another way to avoid this
645 sending of a symlink as an implied directory is to use
646 --copy-unsafe-links, or --copy-dirlinks (both of which also
647 affect symlinks in the rest of the transfer -- see their
648 descriptions for full details).
649
650 -b, --backup
651 With this option, preexisting destination files are renamed as
652 each file is transferred or deleted. You can control where the
653 backup file goes and what (if any) suffix gets appended using
654 the --backup-dir and --suffix options.
655
656 Note that if you don't specify --backup-dir, (1) the
657 --omit-dir-times option will be implied, and (2) if --delete is
658 also in effect (without --delete-excluded), rsync will add a
659 "protect" filter-rule for the backup suffix to the end of all
660 your existing excludes (e.g. -f "P *~"). This will prevent pre‐
661 viously backed-up files from being deleted. Note that if you
662 are supplying your own filter rules, you may need to manually
663 insert your own exclude/protect rule somewhere higher up in the
664 list so that it has a high enough priority to be effective
665 (e.g., if your rules specify a trailing inclusion/exclusion of
666 '*', the auto-added rule would never be reached).
667
668 --backup-dir=DIR
669 In combination with the --backup option, this tells rsync to
670 store all backups in the specified directory on the receiving
671 side. This can be used for incremental backups. You can addi‐
672 tionally specify a backup suffix using the --suffix option (oth‐
673 erwise the files backed up in the specified directory will keep
674 their original filenames).
675
676 --suffix=SUFFIX
677 This option allows you to override the default backup suffix
678 used with the --backup (-b) option. The default suffix is a ~ if
679 no --backup-dir was specified, otherwise it is an empty string.
680
681 -u, --update
682 This forces rsync to skip any files which exist on the destina‐
683 tion and have a modified time that is newer than the source
684 file. (If an existing destination file has a modify time equal
685 to the source file's, it will be updated if the sizes are dif‐
686 ferent.)
687
688 In the current implementation of --update, a difference of file
689 format between the sender and receiver is always considered to
690 be important enough for an update, no matter what date is on the
691 objects. In other words, if the source has a directory or a
692 symlink where the destination has a file, the transfer would
693 occur regardless of the timestamps. This might change in the
694 future (feel free to comment on this on the mailing list if you
695 have an opinion).
696
697 --inplace
698 This causes rsync not to create a new copy of the file and then
699 move it into place. Instead rsync will overwrite the existing
700 file, meaning that the rsync algorithm can't accomplish the full
701 amount of network reduction it might be able to otherwise (since
702 it does not yet try to sort data matches). One exception to
703 this is if you combine the option with --backup, since rsync is
704 smart enough to use the backup file as the basis file for the
705 transfer.
706
707 This option is useful for transfer of large files with block-
708 based changes or appended data, and also on systems that are
709 disk bound, not network bound.
710
711 The option implies --partial (since an interrupted transfer does
712 not delete the file), but conflicts with --partial-dir and
713 --delay-updates. Prior to rsync 2.6.4 --inplace was also incom‐
714 patible with --compare-dest and --link-dest.
715
716 WARNING: The file's data will be in an inconsistent state during
717 the transfer (and possibly afterward if the transfer gets inter‐
718 rupted), so you should not use this option to update files that
719 are in use. Also note that rsync will be unable to update a
720 file in-place that is not writable by the receiving user.
721
722 --append
723 This causes rsync to update a file by appending data onto the
724 end of the file, which presumes that the data that already
725 exists on the receiving side is identical with the start of the
726 file on the sending side. If that is not true, the file will
727 fail the checksum test, and the resend will do a normal
728 --inplace update to correct the mismatched data. Only files on
729 the receiving side that are shorter than the corresponding file
730 on the sending side (as well as new files) are sent. Implies
731 --inplace, but does not conflict with --sparse (though the
732 --sparse option will be auto-disabled if a resend of the
733 already-existing data is required).
734
735 -d, --dirs
736 Tell the sending side to include any directories that are
737 encountered. Unlike --recursive, a directory's contents are not
738 copied unless the directory name specified is "." or ends with a
739 trailing slash (e.g. ".", "dir/.", "dir/", etc.). Without this
740 option or the --recursive option, rsync will skip all directo‐
741 ries it encounters (and output a message to that effect for each
742 one). If you specify both --dirs and --recursive, --recursive
743 takes precedence.
744
745 -l, --links
746 When symlinks are encountered, recreate the symlink on the des‐
747 tination.
748
749 -L, --copy-links
750 When symlinks are encountered, the item that they point to (the
751 referent) is copied, rather than the symlink. In older versions
752 of rsync, this option also had the side-effect of telling the
753 receiving side to follow symlinks, such as symlinks to directo‐
754 ries. In a modern rsync such as this one, you'll need to spec‐
755 ify --keep-dirlinks (-K) to get this extra behavior. The only
756 exception is when sending files to an rsync that is too old to
757 understand -K -- in that case, the -L option will still have the
758 side-effect of -K on that older receiving rsync.
759
760 --copy-unsafe-links
761 This tells rsync to copy the referent of symbolic links that
762 point outside the copied tree. Absolute symlinks are also
763 treated like ordinary files, and so are any symlinks in the
764 source path itself when --relative is used. This option has no
765 additional effect if --copy-links was also specified.
766
767 --safe-links
768 This tells rsync to ignore any symbolic links which point out‐
769 side the copied tree. All absolute symlinks are also ignored.
770 Using this option in conjunction with --relative may give unex‐
771 pected results.
772
773 -K, --copy-dirlinks
774 This option causes the sending side to treat a symlink to a
775 directory as though it were a real directory. This is useful if
776 you don't want symlinks to non-directories to be affected, as
777 they would be using --copy-links.
778
779 Without this option, if the sending side has replaced a direc‐
780 tory with a symlink to a directory, the receiving side will
781 delete anything that is in the way of the new symlink, including
782 a directory hierarchy (as long as --force or --delete is in
783 effect).
784
785 See also --keep-dirlinks for an analogous option for the receiv‐
786 ing side.
787
788 -K, --keep-dirlinks
789 This option causes the receiving side to treat a symlink to a
790 directory as though it were a real directory, but only if it
791 matches a real directory from the sender. Without this option,
792 the receiver's symlink would be deleted and replaced with a real
793 directory.
794
795 For example, suppose you transfer a directory "foo" that con‐
796 tains a file "file", but "foo" is a symlink to directory "bar"
797 on the receiver. Without --keep-dirlinks, the receiver deletes
798 symlink "foo", recreates it as a directory, and receives the
799 file into the new directory. With --keep-dirlinks, the receiver
800 keeps the symlink and "file" ends up in "bar".
801
802 See also --copy-dirlinks for an analogous option for the sending
803 side.
804
805 -H, --hard-links
806 This tells rsync to look for hard-linked files in the transfer
807 and link together the corresponding files on the receiving side.
808 Without this option, hard-linked files in the transfer are
809 treated as though they were separate files.
810
811 Note that rsync can only detect hard links if both parts of the
812 link are in the list of files being sent.
813
814 -p, --perms
815 This option causes the receiving rsync to set the destination
816 permissions to be the same as the source permissions. (See also
817 the --chmod option for a way to modify what rsync considers to
818 be the source permissions.)
819
820 When this option is off, permissions are set as follows:
821
822 o Existing files (including updated files) retain their
823 existing permissions, though the --executability option
824 might change just the execute permission for the file.
825
826 o New files get their "normal" permission bits set to the
827 source file's permissions masked with the receiving
828 directory's default permissions (either the receiving
829 process's umask, or the permissions specified via the
830 destination directory's default ACL), and their special
831 permission bits disabled except in the case where a new
832 directory inherits a setgid bit from its parent direc‐
833 tory.
834
835
836 Thus, when --perms and --executability are both disabled,
837 rsync's behavior is the same as that of other file-copy utili‐
838 ties, such as cp(1) and tar(1).
839
840 In summary: to give destination files (both old and new) the
841 source permissions, use --perms. To give new files the destina‐
842 tion-default permissions (while leaving existing files
843 unchanged), make sure that the --perms option is off and use
844 --chmod=ugo=rwX (which ensures that all non-masked bits get
845 enabled). If you'd care to make this latter behavior easier to
846 type, you could define a popt alias for it, such as putting this
847 line in the file ~/.popt (this defines the -s option, and
848 includes --no-g to use the default group of the destination
849 dir):
850
851 rsync alias -s --no-p --no-g --chmod=ugo=rwX
852
853
854 You could then use this new option in a command such as this
855 one:
856
857 rsync -asv src/ dest/
858
859
860 (Caveat: make sure that -a does not follow -s, or it will re-
861 enable the "--no-*" options.)
862
863 The preservation of the destination's setgid bit on newly-cre‐
864 ated directories when --perms is off was added in rsync 2.6.7.
865 Older rsync versions erroneously preserved the three special
866 permission bits for newly-created files when --perms was off,
867 while overriding the destination's setgid bit setting on a
868 newly-created directory. Default ACL observance was added to
869 the ACL patch for rsync 2.6.7, so older (or non-ACL-enabled)
870 rsyncs use the umask even if default ACLs are present. (Keep in
871 mind that it is the version of the receiving rsync that affects
872 these behaviors.)
873
874 -E, --executability
875 This option causes rsync to preserve the executability (or non-
876 executability) of regular files when --perms is not enabled. A
877 regular file is considered to be executable if at least one 'x'
878 is turned on in its permissions. When an existing destination
879 file's executability differs from that of the corresponding
880 source file, rsync modifies the destination file's permissions
881 as follows:
882
883 o To make a file non-executable, rsync turns off all its
884 'x' permissions.
885
886 o To make a file executable, rsync turns on each 'x' per‐
887 mission that has a corresponding 'r' permission enabled.
888
889
890 If --perms is enabled, this option is ignored.
891
892 -A, --acls
893 This option causes rsync to update the destination ACLs to be
894 the same as the source ACLs. This nonstandard option only works
895 if the remote rsync also supports it. --acls implies --perms.
896
897 Note also that an optimization of the ACL-sending protocol used
898 by this version makes it incompatible with sending files to an
899 older ACL-enabled rsync unless you double the --acls option
900 (e.g. -AA). This doubling is not needed when pulling files from
901 an older rsync.
902
903 -X, --xattrs
904 This option causes rsync to update the remote extended
905 attributes to be the same as the local ones. This will work
906 only if the remote machine's rsync supports this option also.
907 This is a non-standard option.
908
909 --chmod
910 This option tells rsync to apply one or more comma-separated
911 "chmod" strings to the permission of the files in the transfer.
912 The resulting value is treated as though it was the permissions
913 that the sending side supplied for the file, which means that
914 this option can seem to have no effect on existing files if
915 --perms is not enabled.
916
917 In addition to the normal parsing rules specified in the
918 chmod(1) manpage, you can specify an item that should only apply
919 to a directory by prefixing it with a 'D', or specify an item
920 that should only apply to a file by prefixing it with a 'F'.
921 For example:
922
923 --chmod=Dg+s,ug+w,Fo-w,+X
924
925
926 It is also legal to specify multiple --chmod options, as each
927 additional option is just appended to the list of changes to
928 make.
929
930 See the --perms and --executability options for how the result‐
931 ing permission value can be applied to the files in the trans‐
932 fer.
933
934 -o, --owner
935 This option causes rsync to set the owner of the destination
936 file to be the same as the source file, but only if the receiv‐
937 ing rsync is being run as the super-user (see also the --super
938 option to force rsync to attempt super-user activities). With‐
939 out this option, the owner is set to the invoking user on the
940 receiving side.
941
942 The preservation of ownership will associate matching names by
943 default, but may fall back to using the ID number in some cir‐
944 cumstances (see also the --numeric-ids option for a full discus‐
945 sion).
946
947 -g, --group
948 This option causes rsync to set the group of the destination
949 file to be the same as the source file. If the receiving pro‐
950 gram is not running as the super-user (or if --no-super was
951 specified), only groups that the invoking user on the receiving
952 side is a member of will be preserved. Without this option, the
953 group is set to the default group of the invoking user on the
954 receiving side.
955
956 The preservation of group information will associate matching
957 names by default, but may fall back to using the ID number in
958 some circumstances (see also the --numeric-ids option for a full
959 discussion).
960
961 --devices
962 This option causes rsync to transfer character and block device
963 files to the remote system to recreate these devices. This
964 option has no effect if the receiving rsync is not run as the
965 super-user and --super is not specified.
966
967 --specials
968 This option causes rsync to transfer special files such as named
969 sockets and fifos.
970
971 -D The -D option is equivalent to --devices --specials.
972
973 -t, --times
974 This tells rsync to transfer modification times along with the
975 files and update them on the remote system. Note that if this
976 option is not used, the optimization that excludes files that
977 have not been modified cannot be effective; in other words, a
978 missing -t or -a will cause the next transfer to behave as if it
979 used -I, causing all files to be updated (though the rsync algo‐
980 rithm will make the update fairly efficient if the files haven't
981 actually changed, you're much better off using -t).
982
983 -O, --omit-dir-times
984 This tells rsync to omit directories when it is preserving modi‐
985 fication times (see --times). If NFS is sharing the directories
986 on the receiving side, it is a good idea to use -O. This option
987 is inferred if you use --backup without --backup-dir.
988
989 --super
990 This tells the receiving side to attempt super-user activities
991 even if the receiving rsync wasn't run by the super-user. These
992 activities include: preserving users via the --owner option,
993 preserving all groups (not just the current user's groups) via
994 the --groups option, and copying devices via the --devices
995 option. This is useful for systems that allow such activities
996 without being the super-user, and also for ensuring that you
997 will get errors if the receiving side isn't being running as the
998 super-user. To turn off super-user activities, the super-user
999 can use --no-super.
1000
1001 -S, --sparse
1002 Try to handle sparse files efficiently so they take up less
1003 space on the destination. Conflicts with --inplace because it's
1004 not possible to overwrite data in a sparse fashion.
1005
1006 NOTE: Don't use this option when the destination is a Solaris
1007 "tmpfs" filesystem. It doesn't seem to handle seeks over null
1008 regions correctly and ends up corrupting the files.
1009
1010 -n, --dry-run
1011 This tells rsync to not do any file transfers, instead it will
1012 just report the actions it would have taken.
1013
1014 -W, --whole-file
1015 With this option the incremental rsync algorithm is not used and
1016 the whole file is sent as-is instead. The transfer may be
1017 faster if this option is used when the bandwidth between the
1018 source and destination machines is higher than the bandwidth to
1019 disk (especially when the "disk" is actually a networked
1020 filesystem). This is the default when both the source and des‐
1021 tination are specified as local paths.
1022
1023 -x, --one-file-system
1024 This tells rsync to avoid crossing a filesystem boundary when
1025 recursing. This does not limit the user's ability to specify
1026 items to copy from multiple filesystems, just rsync's recursion
1027 through the hierarchy of each directory that the user specified,
1028 and also the analogous recursion on the receiving side during
1029 deletion. Also keep in mind that rsync treats a "bind" mount to
1030 the same device as being on the same filesystem.
1031
1032 If this option is repeated, rsync omits all mount-point directo‐
1033 ries from the copy. Otherwise, it includes an empty directory
1034 at each mount-point it encounters (using the attributes of the
1035 mounted directory because those of the underlying mount-point
1036 directory are inaccessible).
1037
1038 If rsync has been told to collapse symlinks (via --copy-links or
1039 --copy-unsafe-links), a symlink to a directory on another device
1040 is treated like a mount-point. Symlinks to non-directories are
1041 unaffected by this option.
1042
1043 --existing, --ignore-non-existing
1044 This tells rsync to skip creating files (including directories)
1045 that do not exist yet on the destination. If this option is
1046 combined with the --ignore-existing option, no files will be
1047 updated (which can be useful if all you want to do is to delete
1048 extraneous files).
1049
1050 --ignore-existing
1051 This tells rsync to skip updating files that already exist on
1052 the destination (this does not ignore existing directores, or
1053 nothing would get done). See also --existing.
1054
1055 --remove-source-files
1056 This tells rsync to remove from the sending side the files
1057 (meaning non-directories) that are a part of the transfer and
1058 have been successfully duplicated on the receiving side.
1059
1060 --delete
1061 This tells rsync to delete extraneous files from the receiving
1062 side (ones that aren't on the sending side), but only for the
1063 directories that are being synchronized. You must have asked
1064 rsync to send the whole directory (e.g. "dir" or "dir/") without
1065 using a wildcard for the directory's contents (e.g. "dir/*")
1066 since the wildcard is expanded by the shell and rsync thus gets
1067 a request to transfer individual files, not the files' parent
1068 directory. Files that are excluded from transfer are also
1069 excluded from being deleted unless you use the --delete-excluded
1070 option or mark the rules as only matching on the sending side
1071 (see the include/exclude modifiers in the FILTER RULES section).
1072
1073 Prior to rsync 2.6.7, this option would have no effect unless
1074 --recursive was in effect. Beginning with 2.6.7, deletions will
1075 also occur when --dirs (-d) is in effect, but only for directo‐
1076 ries whose contents are being copied.
1077
1078 This option can be dangerous if used incorrectly! It is a very
1079 good idea to run first using the --dry-run option (-n) to see
1080 what files would be deleted to make sure important files aren't
1081 listed.
1082
1083 If the sending side detects any I/O errors, then the deletion of
1084 any files at the destination will be automatically disabled.
1085 This is to prevent temporary filesystem failures (such as NFS
1086 errors) on the sending side causing a massive deletion of files
1087 on the destination. You can override this with the
1088 --ignore-errors option.
1089
1090 The --delete option may be combined with one of the
1091 --delete-WHEN options without conflict, as well as
1092 --delete-excluded. However, if none of the --delete-WHEN
1093 options are specified, rsync will currently choose the
1094 --delete-before algorithm. A future version may change this to
1095 choose the --delete-during algorithm. See also --delete-after.
1096
1097 --delete-before
1098 Request that the file-deletions on the receiving side be done
1099 before the transfer starts. This is the default if --delete or
1100 --delete-excluded is specified without one of the --delete-WHEN
1101 options. See --delete (which is implied) for more details on
1102 file-deletion.
1103
1104 Deleting before the transfer is helpful if the filesystem is
1105 tight for space and removing extraneous files would help to make
1106 the transfer possible. However, it does introduce a delay
1107 before the start of the transfer, and this delay might cause the
1108 transfer to timeout (if --timeout was specified).
1109
1110 --delete-during, --del
1111 Request that the file-deletions on the receiving side be done
1112 incrementally as the transfer happens. This is a faster method
1113 than choosing the before- or after-transfer algorithm, but it is
1114 only supported beginning with rsync version 2.6.4. See --delete
1115 (which is implied) for more details on file-deletion.
1116
1117 --delete-after
1118 Request that the file-deletions on the receiving side be done
1119 after the transfer has completed. This is useful if you are
1120 sending new per-directory merge files as a part of the transfer
1121 and you want their exclusions to take effect for the delete
1122 phase of the current transfer. See --delete (which is implied)
1123 for more details on file-deletion.
1124
1125 --delete-excluded
1126 In addition to deleting the files on the receiving side that are
1127 not on the sending side, this tells rsync to also delete any
1128 files on the receiving side that are excluded (see --exclude).
1129 See the FILTER RULES section for a way to make individual exclu‐
1130 sions behave this way on the receiver, and for a way to protect
1131 files from --delete-excluded. See --delete (which is implied)
1132 for more details on file-deletion.
1133
1134 --ignore-errors
1135 Tells --delete to go ahead and delete files even when there are
1136 I/O errors.
1137
1138 --force
1139 This option tells rsync to delete a non-empty directory when it
1140 is to be replaced by a non-directory. This is only relevant if
1141 deletions are not active (see --delete for details).
1142
1143 Note for older rsync versions: --force used to still be required
1144 when using --delete-after, and it used to be non-functional
1145 unless the --recursive option was also enabled.
1146
1147 --max-delete=NUM
1148 This tells rsync not to delete more than NUM files or directo‐
1149 ries (NUM must be non-zero). This is useful when mirroring very
1150 large trees to prevent disasters.
1151
1152 --max-size=SIZE
1153 This tells rsync to avoid transferring any file that is larger
1154 than the specified SIZE. The SIZE value can be suffixed with a
1155 string to indicate a size multiplier, and may be a fractional
1156 value (e.g. "--max-size=1.5m").
1157
1158 The suffixes are as follows: "K" (or "KiB") is a kibibyte
1159 (1024), "M" (or "MiB") is a mebibyte (1024*1024), and "G" (or
1160 "GiB") is a gibibyte (1024*1024*1024). If you want the multi‐
1161 plier to be 1000 instead of 1024, use "KB", "MB", or "GB".
1162 (Note: lower-case is also accepted for all values.) Finally, if
1163 the suffix ends in either "+1" or "-1", the value will be offset
1164 by one byte in the indicated direction.
1165
1166 Examples: --max-size=1.5mb-1 is 1499999 bytes, and
1167 --max-size=2g+1 is 2147483649 bytes.
1168
1169 --min-size=SIZE
1170 This tells rsync to avoid transferring any file that is smaller
1171 than the specified SIZE, which can help in not transferring
1172 small, junk files. See the --max-size option for a description
1173 of SIZE.
1174
1175 -B, --block-size=BLOCKSIZE
1176 This forces the block size used in the rsync algorithm to a
1177 fixed value. It is normally selected based on the size of each
1178 file being updated. See the technical report for details.
1179
1180 -e, --rsh=COMMAND
1181 This option allows you to choose an alternative remote shell
1182 program to use for communication between the local and remote
1183 copies of rsync. Typically, rsync is configured to use ssh by
1184 default, but you may prefer to use rsh on a local network.
1185
1186 If this option is used with [user@]host::module/path, then the
1187 remote shell COMMAND will be used to run an rsync daemon on the
1188 remote host, and all data will be transmitted through that
1189 remote shell connection, rather than through a direct socket
1190 connection to a running rsync daemon on the remote host. See
1191 the section "USING RSYNC-DAEMON FEATURES VIA A REMOTE-SHELL CON‐
1192 NECTION" above.
1193
1194 Command-line arguments are permitted in COMMAND provided that
1195 COMMAND is presented to rsync as a single argument. You must
1196 use spaces (not tabs or other whitespace) to separate the com‐
1197 mand and args from each other, and you can use single- and/or
1198 double-quotes to preserve spaces in an argument (but not back‐
1199 slashes). Note that doubling a single-quote inside a single-
1200 quoted string gives you a single-quote; likewise for double-
1201 quotes (though you need to pay attention to which quotes your
1202 shell is parsing and which quotes rsync is parsing). Some exam‐
1203 ples:
1204
1205 -e 'ssh -p 2234'
1206 -e 'ssh -o "ProxyCommand nohup ssh firewall nc -w1 %h %p"'
1207
1208
1209 (Note that ssh users can alternately customize site-specific
1210 connect options in their .ssh/config file.)
1211
1212 You can also choose the remote shell program using the RSYNC_RSH
1213 environment variable, which accepts the same range of values as
1214 -e.
1215
1216 See also the --blocking-io option which is affected by this
1217 option.
1218
1219 --rsync-path=PROGRAM
1220 Use this to specify what program is to be run on the remote
1221 machine to start-up rsync. Often used when rsync is not in the
1222 default remote-shell's path (e.g.
1223 --rsync-path=/usr/local/bin/rsync). Note that PROGRAM is run
1224 with the help of a shell, so it can be any program, script, or
1225 command sequence you'd care to run, so long as it does not cor‐
1226 rupt the standard-in & standard-out that rsync is using to com‐
1227 municate.
1228
1229 One tricky example is to set a different default directory on
1230 the remote machine for use with the --relative option. For
1231 instance:
1232
1233 rsync -avR --rsync-path="cd /a/b && rsync" hst:c/d /e/
1234
1235
1236 -C, --cvs-exclude
1237 This is a useful shorthand for excluding a broad range of files
1238 that you often don't want to transfer between systems. It uses
1239 the same algorithm that CVS uses to determine if a file should
1240 be ignored.
1241
1242 The exclude list is initialized to:
1243
1244 RCS SCCS CVS CVS.adm RCSLOG cvslog.* tags TAGS
1245 .make.state .nse_depinfo *~ #* .#* ,* _$* *$ *.old *.bak
1246 *.BAK *.orig *.rej .del-* *.a *.olb *.o *.obj *.so *.exe
1247 *.Z *.elc *.ln core .svn/
1248
1249
1250 then files listed in a $HOME/.cvsignore are added to the list
1251 and any files listed in the CVSIGNORE environment variable (all
1252 cvsignore names are delimited by whitespace).
1253
1254 Finally, any file is ignored if it is in the same directory as a
1255 .cvsignore file and matches one of the patterns listed therein.
1256 Unlike rsync's filter/exclude files, these patterns are split on
1257 whitespace. See the cvs(1) manual for more information.
1258
1259 If you're combining -C with your own --filter rules, you should
1260 note that these CVS excludes are appended at the end of your own
1261 rules, regardless of where the -C was placed on the command-
1262 line. This makes them a lower priority than any rules you spec‐
1263 ified explicitly. If you want to control where these CVS
1264 excludes get inserted into your filter rules, you should omit
1265 the -C as a command-line option and use a combination of --fil‐
1266 ter=:C and --filter=-C (either on your command-line or by
1267 putting the ":C" and "-C" rules into a filter file with your
1268 other rules). The first option turns on the per-directory scan‐
1269 ning for the .cvsignore file. The second option does a one-time
1270 import of the CVS excludes mentioned above.
1271
1272 -f, --filter=RULE
1273 This option allows you to add rules to selectively exclude cer‐
1274 tain files from the list of files to be transferred. This is
1275 most useful in combination with a recursive transfer.
1276
1277 You may use as many --filter options on the command line as you
1278 like to build up the list of files to exclude.
1279
1280 See the FILTER RULES section for detailed information on this
1281 option.
1282
1283 -F The -F option is a shorthand for adding two --filter rules to
1284 your command. The first time it is used is a shorthand for this
1285 rule:
1286
1287 --filter='dir-merge /.rsync-filter'
1288
1289
1290 This tells rsync to look for per-directory .rsync-filter files
1291 that have been sprinkled through the hierarchy and use their
1292 rules to filter the files in the transfer. If -F is repeated,
1293 it is a shorthand for this rule:
1294
1295 --filter='exclude .rsync-filter'
1296
1297
1298 This filters out the .rsync-filter files themselves from the
1299 transfer.
1300
1301 See the FILTER RULES section for detailed information on how
1302 these options work.
1303
1304 --exclude=PATTERN
1305 This option is a simplified form of the --filter option that
1306 defaults to an exclude rule and does not allow the full rule-
1307 parsing syntax of normal filter rules.
1308
1309 See the FILTER RULES section for detailed information on this
1310 option.
1311
1312 --exclude-from=FILE
1313 This option is related to the --exclude option, but it specifies
1314 a FILE that contains exclude patterns (one per line). Blank
1315 lines in the file and lines starting with ';' or '#' are
1316 ignored. If FILE is -, the list will be read from standard
1317 input.
1318
1319 --include=PATTERN
1320 This option is a simplified form of the --filter option that
1321 defaults to an include rule and does not allow the full rule-
1322 parsing syntax of normal filter rules.
1323
1324 See the FILTER RULES section for detailed information on this
1325 option.
1326
1327 --include-from=FILE
1328 This option is related to the --include option, but it specifies
1329 a FILE that contains include patterns (one per line). Blank
1330 lines in the file and lines starting with ';' or '#' are
1331 ignored. If FILE is -, the list will be read from standard
1332 input.
1333
1334 --files-from=FILE
1335 Using this option allows you to specify the exact list of files
1336 to transfer (as read from the specified FILE or - for standard
1337 input). It also tweaks the default behavior of rsync to make
1338 transferring just the specified files and directories easier:
1339
1340 o The --relative (-R) option is implied, which preserves
1341 the path information that is specified for each item in
1342 the file (use --no-relative or --no-R if you want to turn
1343 that off).
1344
1345 o The --dirs (-d) option is implied, which will create
1346 directories specified in the list on the destination
1347 rather than noisily skipping them (use --no-dirs or
1348 --no-d if you want to turn that off).
1349
1350 o The --archive (-a) option's behavior does not imply
1351 --recursive (-r), so specify it explicitly, if you want
1352 it.
1353
1354 o These side-effects change the default state of rsync, so
1355 the position of the --files-from option on the command-
1356 line has no bearing on how other options are parsed (e.g.
1357 -a works the same before or after --files-from, as does
1358 --no-R and all other options).
1359
1360
1361 The file names that are read from the FILE are all relative to
1362 the source dir -- any leading slashes are removed and no ".."
1363 references are allowed to go higher than the source dir. For
1364 example, take this command:
1365
1366 rsync -a --files-from=/tmp/foo /usr remote:/backup
1367
1368
1369 If /tmp/foo contains the string "bin" (or even "/bin"), the
1370 /usr/bin directory will be created as /backup/bin on the remote
1371 host. If it contains "bin/" (note the trailing slash), the
1372 immediate contents of the directory would also be sent (without
1373 needing to be explicitly mentioned in the file -- this began in
1374 version 2.6.4). In both cases, if the -r option was enabled,
1375 that dir's entire hierarchy would also be transferred (keep in
1376 mind that -r needs to be specified explicitly with --files-from,
1377 since it is not implied by -a). Also note that the effect of
1378 the (enabled by default) --relative option is to duplicate only
1379 the path info that is read from the file -- it does not force
1380 the duplication of the source-spec path (/usr in this case).
1381
1382 In addition, the --files-from file can be read from the remote
1383 host instead of the local host if you specify a "host:" in front
1384 of the file (the host must match one end of the transfer). As a
1385 short-cut, you can specify just a prefix of ":" to mean "use the
1386 remote end of the transfer". For example:
1387
1388 rsync -a --files-from=:/path/file-list src:/ /tmp/copy
1389
1390
1391 This would copy all the files specified in the /path/file-list
1392 file that was located on the remote "src" host.
1393
1394 -0, --from0
1395 This tells rsync that the rules/filenames it reads from a file
1396 are terminated by a null ('\0') character, not a NL, CR, or
1397 CR+LF. This affects --exclude-from, --include-from,
1398 --files-from, and any merged files specified in a --filter rule.
1399 It does not affect --cvs-exclude (since all names read from a
1400 .cvsignore file are split on whitespace).
1401
1402 -T, --temp-dir=DIR
1403 This option instructs rsync to use DIR as a scratch directory
1404 when creating temporary copies of the files transferred on the
1405 receiving side. The default behavior is to create each tempo‐
1406 rary file in the same directory as the associated destination
1407 file.
1408
1409 This option is most often used when the receiving disk partition
1410 does not have enough free space to hold a copy of the largest
1411 file in the transfer. In this case (i.e. when the scratch
1412 directory in on a different disk partition), rsync will not be
1413 able to rename each received temporary file over the top of the
1414 associated destination file, but instead must copy it into
1415 place. Rsync does this by copying the file over the top of the
1416 destination file, which means that the destination file will
1417 contain truncated data during this copy. If this were not done
1418 this way (even if the destination file were first removed, the
1419 data locally copied to a temporary file in the destination
1420 directory, and then renamed into place) it would be possible for
1421 the old file to continue taking up disk space (if someone had it
1422 open), and thus there might not be enough room to fit the new
1423 version on the disk at the same time.
1424
1425 If you are using this option for reasons other than a shortage
1426 of disk space, you may wish to combine it with the
1427 --delay-updates option, which will ensure that all copied files
1428 get put into subdirectories in the destination hierarchy, await‐
1429 ing the end of the transfer. If you don't have enough room to
1430 duplicate all the arriving files on the destination partition,
1431 another way to tell rsync that you aren't overly concerned about
1432 disk space is to use the --partial-dir option with a relative
1433 path; because this tells rsync that it is OK to stash off a copy
1434 of a single file in a subdir in the destination hierarchy, rsync
1435 will use the partial-dir as a staging area to bring over the
1436 copied file, and then rename it into place from there. (Specify‐
1437 ing a --partial-dir with an absolute path does not have this
1438 side-effect.)
1439
1440 -y, --fuzzy
1441 This option tells rsync that it should look for a basis file for
1442 any destination file that is missing. The current algorithm
1443 looks in the same directory as the destination file for either a
1444 file that has an identical size and modified-time, or a simi‐
1445 larly-named file. If found, rsync uses the fuzzy basis file to
1446 try to speed up the transfer.
1447
1448 Note that the use of the --delete option might get rid of any
1449 potential fuzzy-match files, so either use --delete-after or
1450 specify some filename exclusions if you need to prevent this.
1451
1452 --compare-dest=DIR
1453 This option instructs rsync to use DIR on the destination
1454 machine as an additional hierarchy to compare destination files
1455 against doing transfers (if the files are missing in the desti‐
1456 nation directory). If a file is found in DIR that is identical
1457 to the sender's file, the file will NOT be transferred to the
1458 destination directory. This is useful for creating a sparse
1459 backup of just files that have changed from an earlier backup.
1460
1461 Beginning in version 2.6.4, multiple --compare-dest directories
1462 may be provided, which will cause rsync to search the list in
1463 the order specified for an exact match. If a match is found
1464 that differs only in attributes, a local copy is made and the
1465 attributes updated. If a match is not found, a basis file from
1466 one of the DIRs will be selected to try to speed up the trans‐
1467 fer.
1468
1469 If DIR is a relative path, it is relative to the destination
1470 directory. See also --copy-dest and --link-dest.
1471
1472 --copy-dest=DIR
1473 This option behaves like --compare-dest, but rsync will also
1474 copy unchanged files found in DIR to the destination directory
1475 using a local copy. This is useful for doing transfers to a new
1476 destination while leaving existing files intact, and then doing
1477 a flash-cutover when all files have been successfully trans‐
1478 ferred.
1479
1480 Multiple --copy-dest directories may be provided, which will
1481 cause rsync to search the list in the order specified for an
1482 unchanged file. If a match is not found, a basis file from one
1483 of the DIRs will be selected to try to speed up the transfer.
1484
1485 If DIR is a relative path, it is relative to the destination
1486 directory. See also --compare-dest and --link-dest.
1487
1488 --link-dest=DIR
1489 This option behaves like --copy-dest, but unchanged files are
1490 hard linked from DIR to the destination directory. The files
1491 must be identical in all preserved attributes (e.g. permissions,
1492 possibly ownership) in order for the files to be linked
1493 together. An example:
1494
1495 rsync -av --link-dest=$PWD/prior_dir host:src_dir/ new_dir/
1496
1497
1498 Beginning in version 2.6.4, multiple --link-dest directories may
1499 be provided, which will cause rsync to search the list in the
1500 order specified for an exact match. If a match is found that
1501 differs only in attributes, a local copy is made and the
1502 attributes updated. If a match is not found, a basis file from
1503 one of the DIRs will be selected to try to speed up the trans‐
1504 fer.
1505
1506 Note that if you combine this option with --ignore-times, rsync
1507 will not link any files together because it only links identical
1508 files together as a substitute for transferring the file, never
1509 as an additional check after the file is updated.
1510
1511 If DIR is a relative path, it is relative to the destination
1512 directory. See also --compare-dest and --copy-dest.
1513
1514 Note that rsync versions prior to 2.6.1 had a bug that could
1515 prevent --link-dest from working properly for a non-super-user
1516 when -o was specified (or implied by -a). You can work-around
1517 this bug by avoiding the -o option when sending to an old rsync.
1518
1519 -z, --compress
1520 With this option, rsync compresses the file data as it is sent
1521 to the destination machine, which reduces the amount of data
1522 being transmitted -- something that is useful over a slow con‐
1523 nection.
1524
1525 Note that this option typically achieves better compression
1526 ratios than can be achieved by using a compressing remote shell
1527 or a compressing transport because it takes advantage of the
1528 implicit information in the matching data blocks that are not
1529 explicitly sent over the connection.
1530
1531 --compress-level=NUM
1532 Explicitly set the compression level to use (see --compress)
1533 instead of letting it default. If NUM is non-zero, the --com‐
1534 press option is implied.
1535
1536 --numeric-ids
1537 With this option rsync will transfer numeric group and user IDs
1538 rather than using user and group names and mapping them at both
1539 ends.
1540
1541 By default rsync will use the username and groupname to deter‐
1542 mine what ownership to give files. The special uid 0 and the
1543 special group 0 are never mapped via user/group names even if
1544 the --numeric-ids option is not specified.
1545
1546 If a user or group has no name on the source system or it has no
1547 match on the destination system, then the numeric ID from the
1548 source system is used instead. See also the comments on the
1549 "use chroot" setting in the rsyncd.conf manpage for information
1550 on how the chroot setting affects rsync's ability to look up the
1551 names of the users and groups and what you can do about it.
1552
1553 --timeout=TIMEOUT
1554 This option allows you to set a maximum I/O timeout in seconds.
1555 If no data is transferred for the specified time then rsync will
1556 exit. The default is 0, which means no timeout.
1557
1558 --address
1559 By default rsync will bind to the wildcard address when connect‐
1560 ing to an rsync daemon. The --address option allows you to
1561 specify a specific IP address (or hostname) to bind to. See
1562 also this option in the --daemon mode section.
1563
1564 --port=PORT
1565 This specifies an alternate TCP port number to use rather than
1566 the default of 873. This is only needed if you are using the
1567 double-colon (::) syntax to connect with an rsync daemon (since
1568 the URL syntax has a way to specify the port as a part of the
1569 URL). See also this option in the --daemon mode section.
1570
1571 --sockopts
1572 This option can provide endless fun for people who like to tune
1573 their systems to the utmost degree. You can set all sorts of
1574 socket options which may make transfers faster (or slower!).
1575 Read the man page for the setsockopt() system call for details
1576 on some of the options you may be able to set. By default no
1577 special socket options are set. This only affects direct socket
1578 connections to a remote rsync daemon. This option also exists
1579 in the --daemon mode section.
1580
1581 --blocking-io
1582 This tells rsync to use blocking I/O when launching a remote
1583 shell transport. If the remote shell is either rsh or remsh,
1584 rsync defaults to using blocking I/O, otherwise it defaults to
1585 using non-blocking I/O. (Note that ssh prefers non-blocking
1586 I/O.)
1587
1588 -i, --itemize-changes
1589 Requests a simple itemized list of the changes that are being
1590 made to each file, including attribute changes. This is exactly
1591 the same as specifying --out-format='%i %n%L'. If you repeat
1592 the option, unchanged files will also be output, but only if the
1593 receiving rsync is at least version 2.6.7 (you can use -vv with
1594 older versions of rsync, but that also turns on the output of
1595 other verbose messages).
1596
1597 The "%i" escape has a cryptic output that is 11 letters long.
1598 The general format is like the string YXcstpoguax, where Y is
1599 replaced by the type of update being done, X is replaced by the
1600 file-type, and the other letters represent attributes that may
1601 be output if they are being modified.
1602
1603 The update types that replace the Y are as follows:
1604
1605 o A < means that a file is being transferred to the remote
1606 host (sent).
1607
1608 o A > means that a file is being transferred to the local
1609 host (received).
1610
1611 o A c means that a local change/creation is occurring for
1612 the item (such as the creation of a directory or the
1613 changing of a symlink, etc.).
1614
1615 o A h means that the item is a hard link to another item
1616 (requires --hard-links).
1617
1618 o A . means that the item is not being updated (though it
1619 might have attributes that are being modified).
1620
1621
1622 The file-types that replace the X are: f for a file, a d for a
1623 directory, an L for a symlink, a D for a device, and a S for a
1624 special file (e.g. named sockets and fifos).
1625
1626 The other letters in the string above are the actual letters
1627 that will be output if the associated attribute for the item is
1628 being updated or a "." for no change. Three exceptions to this
1629 are: (1) a newly created item replaces each letter with a "+",
1630 (2) an identical item replaces the dots with spaces, and (3) an
1631 unknown attribute replaces each letter with a "?" (this can hap‐
1632 pen when talking to an older rsync).
1633
1634 The attribute that is associated with each letter is as follows:
1635
1636 o A c means the checksum of the file is different and will
1637 be updated by the file transfer (requires --checksum).
1638
1639 o A s means the size of the file is different and will be
1640 updated by the file transfer.
1641
1642 o A t means the modification time is different and is being
1643 updated to the sender's value (requires --times). An
1644 alternate value of T means that the time will be set to
1645 the transfer time, which happens anytime a symlink is
1646 transferred, or when a file or device is transferred
1647 without --times.
1648
1649 o A p means the permissions are different and are being
1650 updated to the sender's value (requires --perms).
1651
1652 o An o means the owner is different and is being updated to
1653 the sender's value (requires --owner and super-user priv‐
1654 ileges).
1655
1656 o A g means the group is different and is being updated to
1657 the sender's value (requires --group and the authority to
1658 set the group).
1659
1660 o The u slot is reserved for reporting update (access) time
1661 changes (a feature that is not yet released).
1662
1663 o The a means that the ACL information changed.
1664
1665 o The x slot is reserved for reporting extended attribute
1666 changes (a feature that is not yet released).
1667
1668
1669 One other output is possible: when deleting files, the "%i"
1670 will output the string "*deleting" for each item that is being
1671 removed (assuming that you are talking to a recent enough rsync
1672 that it logs deletions instead of outputting them as a verbose
1673 message).
1674
1675 --out-format=FORMAT
1676 This allows you to specify exactly what the rsync client outputs
1677 to the user on a per-update basis. The format is a text string
1678 containing embedded single-character escape sequences prefixed
1679 with a percent (%) character. For a list of the possible escape
1680 characters, see the "log format" setting in the rsyncd.conf man‐
1681 page.
1682
1683 Specifying this option will mention each file, dir, etc. that
1684 gets updated in a significant way (a transferred file, a recre‐
1685 ated symlink/device, or a touched directory). In addition, if
1686 the itemize-changes escape (%i) is included in the string, the
1687 logging of names increases to mention any item that is changed
1688 in any way (as long as the receiving side is at least 2.6.4).
1689 See the --itemize-changes option for a description of the output
1690 of "%i".
1691
1692 The --verbose option implies a format of "%n%L", but you can use
1693 --out-format without --verbose if you like, or you can override
1694 the format of its per-file output using this option.
1695
1696 Rsync will output the out-format string prior to a file's trans‐
1697 fer unless one of the transfer-statistic escapes is requested,
1698 in which case the logging is done at the end of the file's
1699 transfer. When this late logging is in effect and --progress is
1700 also specified, rsync will also output the name of the file
1701 being transferred prior to its progress information (followed,
1702 of course, by the out-format output).
1703
1704 --log-file=FILE
1705 This option causes rsync to log what it is doing to a file.
1706 This is similar to the logging that a daemon does, but can be
1707 requested for the client side and/or the server side of a non-
1708 daemon transfer. If specified as a client option, transfer log‐
1709 ging will be enabled with a default format of "%i %n%L". See
1710 the --log-file-format option if you wish to override this.
1711
1712 Here's a example command that requests the remote side to log
1713 what is happening:
1714
1715 rsync -av --rsync-path="rsync --log-file=/tmp/rlog" src/ dest/
1716
1717
1718 This is very useful if you need to debug why a connection is
1719 closing unexpectedly.
1720
1721 --log-file-format=FORMAT
1722 This allows you to specify exactly what per-update logging is
1723 put into the file specified by the --log-file option (which must
1724 also be specified for this option to have any effect). If you
1725 specify an empty string, updated files will not be mentioned in
1726 the log file. For a list of the possible escape characters, see
1727 the "log format" setting in the rsyncd.conf manpage.
1728
1729 --stats
1730 This tells rsync to print a verbose set of statistics on the
1731 file transfer, allowing you to tell how effective the rsync
1732 algorithm is for your data.
1733
1734 The current statistics are as follows:
1735
1736 o Number of files is the count of all "files" (in the
1737 generic sense), which includes directories, symlinks,
1738 etc.
1739
1740 o Number of files transferred is the count of normal files
1741 that were updated via the rsync algorithm, which does not
1742 include created dirs, symlinks, etc.
1743
1744 o Total file size is the total sum of all file sizes in the
1745 transfer. This does not count any size for directories
1746 or special files, but does include the size of symlinks.
1747
1748 o Total transferred file size is the total sum of all files
1749 sizes for just the transferred files.
1750
1751 o Literal data is how much unmatched file-update data we
1752 had to send to the receiver for it to recreate the
1753 updated files.
1754
1755 o Matched data is how much data the receiver got locally
1756 when recreating the updated files.
1757
1758 o File list size is how big the file-list data was when the
1759 sender sent it to the receiver. This is smaller than the
1760 in-memory size for the file list due to some compressing
1761 of duplicated data when rsync sends the list.
1762
1763 o File list generation time is the number of seconds that
1764 the sender spent creating the file list. This requires a
1765 modern rsync on the sending side for this to be present.
1766
1767 o File list transfer time is the number of seconds that the
1768 sender spent sending the file list to the receiver.
1769
1770 o Total bytes sent is the count of all the bytes that rsync
1771 sent from the client side to the server side.
1772
1773 o Total bytes received is the count of all non-message
1774 bytes that rsync received by the client side from the
1775 server side. "Non-message" bytes means that we don't
1776 count the bytes for a verbose message that the server
1777 sent to us, which makes the stats more consistent.
1778
1779
1780 -8, --8-bit-output
1781 This tells rsync to leave all high-bit characters unescaped in
1782 the output instead of trying to test them to see if they're
1783 valid in the current locale and escaping the invalid ones. All
1784 control characters (but never tabs) are always escaped, regard‐
1785 less of this option's setting.
1786
1787 The escape idiom that started in 2.6.7 is to output a literal
1788 backslash (\) and a hash (#), followed by exactly 3 octal dig‐
1789 its. For example, a newline would output as "\#012". A literal
1790 backslash that is in a filename is not escaped unless it is fol‐
1791 lowed by a hash and 3 digits (0-9).
1792
1793 -h, --human-readable
1794 Output numbers in a more human-readable format. This makes big
1795 numbers output using larger units, with a K, M, or G suffix. If
1796 this option was specified once, these units are K (1000), M
1797 (1000*1000), and G (1000*1000*1000); if the option is repeated,
1798 the units are powers of 1024 instead of 1000.
1799
1800 --partial
1801 By default, rsync will delete any partially transferred file if
1802 the transfer is interrupted. In some circumstances it is more
1803 desirable to keep partially transferred files. Using the --par‐
1804 tial option tells rsync to keep the partial file which should
1805 make a subsequent transfer of the rest of the file much faster.
1806
1807 --partial-dir=DIR
1808 A better way to keep partial files than the --partial option is
1809 to specify a DIR that will be used to hold the partial data
1810 (instead of writing it out to the destination file). On the
1811 next transfer, rsync will use a file found in this dir as data
1812 to speed up the resumption of the transfer and then delete it
1813 after it has served its purpose.
1814
1815 Note that if --whole-file is specified (or implied), any par‐
1816 tial-dir file that is found for a file that is being updated
1817 will simply be removed (since rsync is sending files without
1818 using the incremental rsync algorithm).
1819
1820 Rsync will create the DIR if it is missing (just the last dir --
1821 not the whole path). This makes it easy to use a relative path
1822 (such as "--partial-dir=.rsync-partial") to have rsync create
1823 the partial-directory in the destination file's directory when
1824 needed, and then remove it again when the partial file is
1825 deleted.
1826
1827 If the partial-dir value is not an absolute path, rsync will add
1828 an exclude rule at the end of all your existing excludes. This
1829 will prevent the sending of any partial-dir files that may exist
1830 on the sending side, and will also prevent the untimely deletion
1831 of partial-dir items on the receiving side. An example: the
1832 above --partial-dir option would add the equivalent of
1833 "--exclude=.rsync-partial/" at the end of any other filter
1834 rules.
1835
1836 If you are supplying your own exclude rules, you may need to add
1837 your own exclude/hide/protect rule for the partial-dir because
1838 (1) the auto-added rule may be ineffective at the end of your
1839 other rules, or (2) you may wish to override rsync's exclude
1840 choice. For instance, if you want to make rsync clean-up any
1841 left-over partial-dirs that may be lying around, you should
1842 specify --delete-after and add a "risk" filter rule, e.g. -f 'R
1843 .rsync-partial/'. (Avoid using --delete-before or --delete-dur‐
1844 ing unless you don't need rsync to use any of the left-over par‐
1845 tial-dir data during the current run.)
1846
1847 IMPORTANT: the --partial-dir should not be writable by other
1848 users or it is a security risk. E.g. AVOID "/tmp".
1849
1850 You can also set the partial-dir value the RSYNC_PARTIAL_DIR
1851 environment variable. Setting this in the environment does not
1852 force --partial to be enabled, but rather it affects where par‐
1853 tial files go when --partial is specified. For instance,
1854 instead of using --partial-dir=.rsync-tmp along with --progress,
1855 you could set RSYNC_PARTIAL_DIR=.rsync-tmp in your environment
1856 and then just use the -P option to turn on the use of the
1857 .rsync-tmp dir for partial transfers. The only times that the
1858 --partial option does not look for this environment value are
1859 (1) when --inplace was specified (since --inplace conflicts with
1860 --partial-dir), and (2) when --delay-updates was specified (see
1861 below).
1862
1863 For the purposes of the daemon-config's "refuse options" set‐
1864 ting, --partial-dir does not imply --partial. This is so that a
1865 refusal of the --partial option can be used to disallow the
1866 overwriting of destination files with a partial transfer, while
1867 still allowing the safer idiom provided by --partial-dir.
1868
1869 --delay-updates
1870 This option puts the temporary file from each updated file into
1871 a holding directory until the end of the transfer, at which time
1872 all the files are renamed into place in rapid succession. This
1873 attempts to make the updating of the files a little more atomic.
1874 By default the files are placed into a directory named ".~tmp~"
1875 in each file's destination directory, but if you've specified
1876 the --partial-dir option, that directory will be used instead.
1877 See the comments in the --partial-dir section for a discussion
1878 of how this ".~tmp~" dir will be excluded from the transfer, and
1879 what you can do if you wnat rsync to cleanup old ".~tmp~" dirs
1880 that might be lying around. Conflicts with --inplace and
1881 --append.
1882
1883 This option uses more memory on the receiving side (one bit per
1884 file transferred) and also requires enough free disk space on
1885 the receiving side to hold an additional copy of all the updated
1886 files. Note also that you should not use an absolute path to
1887 --partial-dir [22munless (1) there is no chance of any of the files
1888 in the transfer having the same name (since all the updated
1889 files will be put into a single directory if the path is abso‐
1890 lute) and (2) there are no mount points in the hierarchy (since
1891 the delayed updates will fail if they can't be renamed into
1892 place).
1893
1894 See also the "atomic-rsync" perl script in the "support" subdir
1895 for an update algorithm that is even more atomic (it uses
1896 --link-dest and a parallel hierarchy of files).
1897
1898 -m, --prune-empty-dirs
1899 This option tells the receiving rsync to get rid of empty direc‐
1900 tories from the file-list, including nested directories that
1901 have no non-directory children. This is useful for avoiding the
1902 creation of a bunch of useless directories when the sending
1903 rsync is recursively scanning a hierarchy of files using
1904 include/exclude/filter rules.
1905
1906 Because the file-list is actually being pruned, this option also
1907 affects what directories get deleted when a delete is active.
1908 However, keep in mind that excluded files and directories can
1909 prevent existing items from being deleted (because an exclude
1910 hides source files and protects destination files).
1911
1912 You can prevent the pruning of certain empty directories from
1913 the file-list by using a global "protect" filter. For instance,
1914 this option would ensure that the directory "emptydir" was kept
1915 in the file-list:
1916
1917 --filter 'protect emptydir/'
1918
1919
1920 Here's an example that copies all .pdf files in a hierarchy,
1921 only creating the necessary destination directories to hold the
1922 .pdf files, and ensures that any superfluous files and directo‐
1923 ries in the destination are removed (note the hide filter of
1924 non-directories being used instead of an exclude):
1925
1926 rsync -avm --del --include='*.pdf' -f 'hide,! */' src/ dest
1927
1928
1929 If you didn't want to remove superfluous destination files, the
1930 more time-honored options of "--include='*/' --exclude='*'"
1931 would work fine in place of the hide-filter (if that is more
1932 natural to you).
1933
1934 --progress
1935 This option tells rsync to print information showing the
1936 progress of the transfer. This gives a bored user something to
1937 watch. Implies --verbose if it wasn't already specified.
1938
1939 While rsync is transferring a regular file, it updates a
1940 progress line that looks like this:
1941
1942 782448 63% 110.64kB/s 0:00:04
1943
1944
1945 In this example, the receiver has reconstructed 782448 bytes or
1946 63% of the sender's file, which is being reconstructed at a rate
1947 of 110.64 kilobytes per second, and the transfer will finish in
1948 4 seconds if the current rate is maintained until the end.
1949
1950 These statistics can be misleading if the incremental transfer
1951 algorithm is in use. For example, if the sender's file consists
1952 of the basis file followed by additional data, the reported rate
1953 will probably drop dramatically when the receiver gets to the
1954 literal data, and the transfer will probably take much longer to
1955 finish than the receiver estimated as it was finishing the
1956 matched part of the file.
1957
1958 When the file transfer finishes, rsync replaces the progress
1959 line with a summary line that looks like this:
1960
1961 1238099 100% 146.38kB/s 0:00:08 (xfer#5, to-check=169/396)
1962
1963
1964 In this example, the file was 1238099 bytes long in total, the
1965 average rate of transfer for the whole file was 146.38 kilobytes
1966 per second over the 8 seconds that it took to complete, it was
1967 the 5th transfer of a regular file during the current rsync ses‐
1968 sion, and there are 169 more files for the receiver to check (to
1969 see if they are up-to-date or not) remaining out of the 396
1970 total files in the file-list.
1971
1972 -P The -P option is equivalent to --partial --progress. Its pur‐
1973 pose is to make it much easier to specify these two options for
1974 a long transfer that may be interrupted.
1975
1976 --password-file
1977 This option allows you to provide a password in a file for
1978 accessing a remote rsync daemon. Note that this option is only
1979 useful when accessing an rsync daemon using the built in trans‐
1980 port, not when using a remote shell as the transport. The file
1981 must not be world readable. It should contain just the password
1982 as a single line.
1983
1984 --list-only
1985 This option will cause the source files to be listed instead of
1986 transferred. This option is inferred if there is a single
1987 source arg and no destination specified, so its main uses are:
1988 (1) to turn a copy command that includes a destination arg into
1989 a file-listing command, (2) to be able to specify more than one
1990 local source arg (note: be sure to include the destination), or
1991 (3) to avoid the automatically added "-r --exclude='/*/*'"
1992 options that rsync usually uses as a compatibility kluge when
1993 generating a non-recursive listing. Caution: keep in mind that
1994 a source arg with a wild-card is expanded by the shell into mul‐
1995 tiple args, so it is never safe to try to list such an arg with‐
1996 out using this option. For example:
1997
1998 rsync -av --list-only foo* dest/
1999
2000
2001 --bwlimit=KBPS
2002 This option allows you to specify a maximum transfer rate in
2003 kilobytes per second. This option is most effective when using
2004 rsync with large files (several megabytes and up). Due to the
2005 nature of rsync transfers, blocks of data are sent, then if
2006 rsync determines the transfer was too fast, it will wait before
2007 sending the next data block. The result is an average transfer
2008 rate equaling the specified limit. A value of zero specifies no
2009 limit.
2010
2011 --write-batch=FILE
2012 Record a file that can later be applied to another identical
2013 destination with --read-batch. See the "BATCH MODE" section for
2014 details, and also the --only-write-batch option.
2015
2016 --only-write-batch=FILE
2017 Works like --write-batch, except that no updates are made on the
2018 destination system when creating the batch. This lets you
2019 transport the changes to the destination system via some other
2020 means and then apply the changes via --read-batch.
2021
2022 Note that you can feel free to write the batch directly to some
2023 portable media: if this media fills to capacity before the end
2024 of the transfer, you can just apply that partial transfer to the
2025 destination and repeat the whole process to get the rest of the
2026 changes (as long as you don't mind a partially updated destina‐
2027 tion system while the multi-update cycle is happening).
2028
2029 Also note that you only save bandwidth when pushing changes to a
2030 remote system because this allows the batched data to be
2031 diverted from the sender into the batch file without having to
2032 flow over the wire to the receiver (when pulling, the sender is
2033 remote, and thus can't write the batch).
2034
2035 --read-batch=FILE
2036 Apply all of the changes stored in FILE, a file previously gen‐
2037 erated by --write-batch. If FILE is -, the batch data will be
2038 read from standard input. See the "BATCH MODE" section for
2039 details.
2040
2041 --protocol=NUM
2042 Force an older protocol version to be used. This is useful for
2043 creating a batch file that is compatible with an older version
2044 of rsync. For instance, if rsync 2.6.4 is being used with the
2045 --write-batch option, but rsync 2.6.3 is what will be used to
2046 run the --read-batch option, you should use "--protocol=28" when
2047 creating the batch file to force the older protocol version to
2048 be used in the batch file (assuming you can't upgrade the rsync
2049 on the reading system).
2050
2051 -4, --ipv4 or -6, --ipv6
2052 Tells rsync to prefer IPv4/IPv6 when creating sockets. This
2053 only affects sockets that rsync has direct control over, such as
2054 the outgoing socket when directly contacting an rsync daemon.
2055 See also these options in the --daemon mode section.
2056
2057 --checksum-seed=NUM
2058 Set the MD4 checksum seed to the integer NUM. This 4 byte
2059 checksum seed is included in each block and file MD4 checksum
2060 calculation. By default the checksum seed is generated by the
2061 server and defaults to the current time() . This option is used
2062 to set a specific checksum seed, which is useful for applica‐
2063 tions that want repeatable block and file checksums, or in the
2064 case where the user wants a more random checksum seed. Note
2065 that setting NUM to 0 causes rsync to use the default of time()
2066 for checksum seed.
2067
2068
2070 The options allowed when starting an rsync daemon are as follows:
2071
2072 --daemon
2073 This tells rsync that it is to run as a daemon. The daemon you
2074 start running may be accessed using an rsync client using the
2075 host::module or rsync://host/module/ syntax.
2076
2077 If standard input is a socket then rsync will assume that it is
2078 being run via inetd, otherwise it will detach from the current
2079 terminal and become a background daemon. The daemon will read
2080 the config file (rsyncd.conf) on each connect made by a client
2081 and respond to requests accordingly. See the rsyncd.conf(5) man
2082 page for more details.
2083
2084 --address
2085 By default rsync will bind to the wildcard address when run as a
2086 daemon with the --daemon option. The --address option allows
2087 you to specify a specific IP address (or hostname) to bind to.
2088 This makes virtual hosting possible in conjunction with the
2089 --config option. See also the "address" global option in the
2090 rsyncd.conf manpage.
2091
2092 --bwlimit=KBPS
2093 This option allows you to specify a maximum transfer rate in
2094 kilobytes per second for the data the daemon sends. The client
2095 can still specify a smaller --bwlimit value, but their requested
2096 value will be rounded down if they try to exceed it. See the
2097 client version of this option (above) for some extra details.
2098
2099 --config=FILE
2100 This specifies an alternate config file than the default. This
2101 is only relevant when --daemon is specified. The default is
2102 /etc/rsyncd.conf unless the daemon is running over a remote
2103 shell program and the remote user is not the super-user; in that
2104 case the default is rsyncd.conf in the current directory (typi‐
2105 cally $HOME).
2106
2107 --no-detach
2108 When running as a daemon, this option instructs rsync to not
2109 detach itself and become a background process. This option is
2110 required when running as a service on Cygwin, and may also be
2111 useful when rsync is supervised by a program such as daemontools
2112 or AIX's System Resource Controller. --no-detach is also recom‐
2113 mended when rsync is run under a debugger. This option has no
2114 effect if rsync is run from inetd or sshd.
2115
2116 --port=PORT
2117 This specifies an alternate TCP port number for the daemon to
2118 listen on rather than the default of 873. See also the "port"
2119 global option in the rsyncd.conf manpage.
2120
2121 --log-file=FILE
2122 This option tells the rsync daemon to use the given log-file
2123 name instead of using the "log file" setting in the config file.
2124
2125 --log-file-format=FORMAT
2126 This option tells the rsync daemon to use the given FORMAT
2127 string instead of using the "log format" setting in the config
2128 file. It also enables "transfer logging" unless the string is
2129 empty, in which case transfer logging is turned off.
2130
2131 --sockopts
2132 This overrides the socket options setting in the rsyncd.conf
2133 file and has the same syntax.
2134
2135 -v, --verbose
2136 This option increases the amount of information the daemon logs
2137 during its startup phase. After the client connects, the dae‐
2138 mon's verbosity level will be controlled by the options that the
2139 client used and the "max verbosity" setting in the module's con‐
2140 fig section.
2141
2142 -4, --ipv4 or -6, --ipv6
2143 Tells rsync to prefer IPv4/IPv6 when creating the incoming sock‐
2144 ets that the rsync daemon will use to listen for connections.
2145 One of these options may be required in older versions of Linux
2146 to work around an IPv6 bug in the kernel (if you see an "address
2147 already in use" error when nothing else is using the port, try
2148 specifying --ipv6 or --ipv4 when starting the daemon).
2149
2150 -h, --help
2151 When specified after --daemon, print a short help page describ‐
2152 ing the options available for starting an rsync daemon.
2153
2154
2156 The filter rules allow for flexible selection of which files to trans‐
2157 fer (include) and which files to skip (exclude). The rules either
2158 directly specify include/exclude patterns or they specify a way to
2159 acquire more include/exclude patterns (e.g. to read them from a file).
2160
2161 As the list of files/directories to transfer is built, rsync checks
2162 each name to be transferred against the list of include/exclude pat‐
2163 terns in turn, and the first matching pattern is acted on: if it is an
2164 exclude pattern, then that file is skipped; if it is an include pattern
2165 then that filename is not skipped; if no matching pattern is found,
2166 then the filename is not skipped.
2167
2168 Rsync builds an ordered list of filter rules as specified on the com‐
2169 mand-line. Filter rules have the following syntax:
2170
2171 RULE [PATTERN_OR_FILENAME]
2172 RULE,MODIFIERS [PATTERN_OR_FILENAME]
2173
2174
2175 You have your choice of using either short or long RULE names, as
2176 described below. If you use a short-named rule, the ',' separating the
2177 RULE from the MODIFIERS is optional. The PATTERN or FILENAME that fol‐
2178 lows (when present) must come after either a single space or an under‐
2179 score (_). Here are the available rule prefixes:
2180
2181 exclude, - specifies an exclude pattern.
2182 include, + specifies an include pattern.
2183 merge, . specifies a merge-file to read for more rules.
2184 dir-merge, : specifies a per-directory merge-file.
2185 hide, H specifies a pattern for hiding files from the transfer.
2186 show, S files that match the pattern are not hidden.
2187 protect, P specifies a pattern for protecting files from dele‐
2188 tion.
2189 risk, R files that match the pattern are not protected.
2190 clear, ! clears the current include/exclude list (takes no arg)
2191
2192
2193 When rules are being read from a file, empty lines are ignored, as are
2194 comment lines that start with a "#".
2195
2196 Note that the --include/--exclude command-line options do not allow the
2197 full range of rule parsing as described above -- they only allow the
2198 specification of include/exclude patterns plus a "!" token to clear the
2199 list (and the normal comment parsing when rules are read from a file).
2200 If a pattern does not begin with "- " (dash, space) or "+ " (plus,
2201 space), then the rule will be interpreted as if "+ " (for an include
2202 option) or "- " (for an exclude option) were prefixed to the string. A
2203 --filter option, on the other hand, must always contain either a short
2204 or long rule name at the start of the rule.
2205
2206 Note also that the --filter, --include, and --exclude options take one
2207 rule/pattern each. To add multiple ones, you can repeat the options on
2208 the command-line, use the merge-file syntax of the --filter option, or
2209 the --include-from/--exclude-from options.
2210
2212 You can include and exclude files by specifying patterns using the "+",
2213 "-", etc. filter rules (as introduced in the FILTER RULES section
2214 above). The include/exclude rules each specify a pattern that is
2215 matched against the names of the files that are going to be trans‐
2216 ferred. These patterns can take several forms:
2217
2218 o if the pattern starts with a / then it is anchored to a particu‐
2219 lar spot in the hierarchy of files, otherwise it is matched
2220 against the end of the pathname. This is similar to a leading ^
2221 in regular expressions. Thus "/foo" would match a file named
2222 "foo" at either the "root of the transfer" (for a global rule)
2223 or in the merge-file's directory (for a per-directory rule). An
2224 unqualified "foo" would match any file or directory named "foo"
2225 anywhere in the tree because the algorithm is applied recur‐
2226 sively from the top down; it behaves as if each path component
2227 gets a turn at being the end of the file name. Even the unan‐
2228 chored "sub/foo" would match at any point in the hierarchy where
2229 a "foo" was found within a directory named "sub". See the sec‐
2230 tion on ANCHORING INCLUDE/EXCLUDE PATTERNS for a full discussion
2231 of how to specify a pattern that matches at the root of the
2232 transfer.
2233
2234 o if the pattern ends with a / then it will only match a direc‐
2235 tory, not a file, link, or device.
2236
2237 o rsync chooses between doing a simple string match and wildcard
2238 matching by checking if the pattern contains one of these three
2239 wildcard characters: '*', '?', and '[' .
2240
2241 o a '*' matches any non-empty path component (it stops at
2242 slashes).
2243
2244 o use '**' to match anything, including slashes.
2245
2246 o a '?' matches any character except a slash (/).
2247
2248 o a '[' introduces a character class, such as [a-z] or
2249 [[:alpha:]].
2250
2251 o in a wildcard pattern, a backslash can be used to escape a wild‐
2252 card character, but it is matched literally when no wildcards
2253 are present.
2254
2255 o if the pattern contains a / (not counting a trailing /) or a
2256 "**", then it is matched against the full pathname, including
2257 any leading directories. If the pattern doesn't contain a / or a
2258 "**", then it is matched only against the final component of the
2259 filename. (Remember that the algorithm is applied recursively
2260 so "full filename" can actually be any portion of a path from
2261 the starting directory on down.)
2262
2263 o a trailing "dir_name/***" will match both the directory (as if
2264 "dir_name/" had been specified) and all the files in the direc‐
2265 tory (as if "dir_name/**" had been specified). (This behavior
2266 is new for version 2.6.7.)
2267
2268
2269 Note that, when using the --recursive (-r) option (which is implied by
2270 -a), every subcomponent of every path is visited from the top down, so
2271 include/exclude patterns get applied recursively to each subcomponent's
2272 full name (e.g. to include "/foo/bar/baz" the subcomponents "/foo" and
2273 "/foo/bar" must not be excluded). The exclude patterns actually short-
2274 circuit the directory traversal stage when rsync finds the files to
2275 send. If a pattern excludes a particular parent directory, it can ren‐
2276 der a deeper include pattern ineffectual because rsync did not descend
2277 through that excluded section of the hierarchy. This is particularly
2278 important when using a trailing '*' rule. For instance, this won't
2279 work:
2280
2281 + /some/path/this-file-will-not-be-found
2282 + /file-is-included
2283 - *
2284
2285
2286 This fails because the parent directory "some" is excluded by the '*'
2287 rule, so rsync never visits any of the files in the "some" or
2288 "some/path" directories. One solution is to ask for all directories in
2289 the hierarchy to be included by using a single rule: "+ */" (put it
2290 somewhere before the "- *" rule), and perhaps use the
2291 --prune-empty-dirs option. Another solution is to add specific include
2292 rules for all the parent dirs that need to be visited. For instance,
2293 this set of rules works fine:
2294
2295 + /some/
2296 + /some/path/
2297 + /some/path/this-file-is-found
2298 + /file-also-included
2299 - *
2300
2301
2302 Here are some examples of exclude/include matching:
2303
2304 o "- *.o" would exclude all filenames matching *.o
2305
2306 o "- /foo" would exclude a file (or directory) named foo in the
2307 transfer-root directory
2308
2309 o "- foo/" would exclude any directory named foo
2310
2311 o "- /foo/*/bar" would exclude any file named bar which is at two
2312 levels below a directory named foo in the transfer-root direc‐
2313 tory
2314
2315 o "- /foo/**/bar" would exclude any file named bar two or more
2316 levels below a directory named foo in the transfer-root direc‐
2317 tory
2318
2319 o The combination of "+ */", "+ *.c", and "- *" would include all
2320 directories and C source files but nothing else (see also the
2321 --prune-empty-dirs option)
2322
2323 o The combination of "+ foo/", "+ foo/bar.c", and "- *" would
2324 include only the foo directory and foo/bar.c (the foo directory
2325 must be explicitly included or it would be excluded by the "*")
2326
2327
2329 You can merge whole files into your filter rules by specifying either a
2330 merge (.) or a dir-merge (:) filter rule (as introduced in the FILTER
2331 RULES section above).
2332
2333 There are two kinds of merged files -- single-instance ('.') and per-
2334 directory (':'). A single-instance merge file is read one time, and
2335 its rules are incorporated into the filter list in the place of the "."
2336 rule. For per-directory merge files, rsync will scan every directory
2337 that it traverses for the named file, merging its contents when the
2338 file exists into the current list of inherited rules. These per-direc‐
2339 tory rule files must be created on the sending side because it is the
2340 sending side that is being scanned for the available files to transfer.
2341 These rule files may also need to be transferred to the receiving side
2342 if you want them to affect what files don't get deleted (see PER-DIREC‐
2343 TORY RULES AND DELETE below).
2344
2345 Some examples:
2346
2347 merge /etc/rsync/default.rules
2348 . /etc/rsync/default.rules
2349 dir-merge .per-dir-filter
2350 dir-merge,n- .non-inherited-per-dir-excludes
2351 :n- .non-inherited-per-dir-excludes
2352
2353
2354 The following modifiers are accepted after a merge or dir-merge rule:
2355
2356 o A - specifies that the file should consist of only exclude pat‐
2357 terns, with no other rule-parsing except for in-file comments.
2358
2359 o A + specifies that the file should consist of only include pat‐
2360 terns, with no other rule-parsing except for in-file comments.
2361
2362 o A C is a way to specify that the file should be read in a CVS-
2363 compatible manner. This turns on 'n', 'w', and '-', but also
2364 allows the list-clearing token (!) to be specified. If no file‐
2365 name is provided, ".cvsignore" is assumed.
2366
2367 o A e will exclude the merge-file name from the transfer; e.g.
2368 "dir-merge,e .rules" is like "dir-merge .rules" and "- .rules".
2369
2370 o An n specifies that the rules are not inherited by subdirecto‐
2371 ries.
2372
2373 o A w specifies that the rules are word-split on whitespace
2374 instead of the normal line-splitting. This also turns off com‐
2375 ments. Note: the space that separates the prefix from the rule
2376 is treated specially, so "- foo + bar" is parsed as two rules
2377 (assuming that prefix-parsing wasn't also disabled).
2378
2379 o You may also specify any of the modifiers for the "+" or "-"
2380 rules (below) in order to have the rules that are read in from
2381 the file default to having that modifier set. For instance,
2382 "merge,-/ .excl" would treat the contents of .excl as absolute-
2383 path excludes, while "dir-merge,s .filt" and ":sC" would each
2384 make all their per-directory rules apply only on the sending
2385 side.
2386
2387
2388 The following modifiers are accepted after a "+" or "-":
2389
2390 o A "/" specifies that the include/exclude rule should be matched
2391 against the absolute pathname of the current item. For example,
2392 "-/ /etc/passwd" would exclude the passwd file any time the
2393 transfer was sending files from the "/etc" directory, and "-/
2394 subdir/foo" would always exclude "foo" when it is in a dir named
2395 "subdir", even if "foo" is at the root of the current transfer.
2396
2397 o A "!" specifies that the include/exclude should take effect if
2398 the pattern fails to match. For instance, "-! */" would exclude
2399 all non-directories.
2400
2401 o A C is used to indicate that all the global CVS-exclude rules
2402 should be inserted as excludes in place of the "-C". No arg
2403 should follow.
2404
2405 o An s is used to indicate that the rule applies to the sending
2406 side. When a rule affects the sending side, it prevents files
2407 from being transferred. The default is for a rule to affect
2408 both sides unless --delete-excluded was specified, in which case
2409 default rules become sender-side only. See also the hide (H)
2410 and show (S) rules, which are an alternate way to specify send‐
2411 ing-side includes/excludes.
2412
2413 o An r is used to indicate that the rule applies to the receiving
2414 side. When a rule affects the receiving side, it prevents files
2415 from being deleted. See the s modifier for more info. See also
2416 the protect (P) and risk (R) rules, which are an alternate way
2417 to specify receiver-side includes/excludes.
2418
2419
2420 Per-directory rules are inherited in all subdirectories of the direc‐
2421 tory where the merge-file was found unless the 'n' modifier was used.
2422 Each subdirectory's rules are prefixed to the inherited per-directory
2423 rules from its parents, which gives the newest rules a higher priority
2424 than the inherited rules. The entire set of dir-merge rules are
2425 grouped together in the spot where the merge-file was specified, so it
2426 is possible to override dir-merge rules via a rule that got specified
2427 earlier in the list of global rules. When the list-clearing rule ("!")
2428 is read from a per-directory file, it only clears the inherited rules
2429 for the current merge file.
2430
2431 Another way to prevent a single rule from a dir-merge file from being
2432 inherited is to anchor it with a leading slash. Anchored rules in a
2433 per-directory merge-file are relative to the merge-file's directory, so
2434 a pattern "/foo" would only match the file "foo" in the directory where
2435 the dir-merge filter file was found.
2436
2437 Here's an example filter file which you'd specify via --filter=".
2438 file":
2439
2440 merge /home/user/.global-filter
2441 - *.gz
2442 dir-merge .rules
2443 + *.[ch]
2444 - *.o
2445
2446
2447 This will merge the contents of the /home/user/.global-filter file at
2448 the start of the list and also turns the ".rules" filename into a per-
2449 directory filter file. All rules read in prior to the start of the
2450 directory scan follow the global anchoring rules (i.e. a leading slash
2451 matches at the root of the transfer).
2452
2453 If a per-directory merge-file is specified with a path that is a parent
2454 directory of the first transfer directory, rsync will scan all the par‐
2455 ent dirs from that starting point to the transfer directory for the
2456 indicated per-directory file. For instance, here is a common filter
2457 (see -F):
2458
2459 --filter=': /.rsync-filter'
2460
2461
2462 That rule tells rsync to scan for the file .rsync-filter in all direc‐
2463 tories from the root down through the parent directory of the transfer
2464 prior to the start of the normal directory scan of the file in the
2465 directories that are sent as a part of the transfer. (Note: for an
2466 rsync daemon, the root is always the same as the module's "path".)
2467
2468 Some examples of this pre-scanning for per-directory files:
2469
2470 rsync -avF /src/path/ /dest/dir
2471 rsync -av --filter=': ../../.rsync-filter' /src/path/ /dest/dir
2472 rsync -av --filter=': .rsync-filter' /src/path/ /dest/dir
2473
2474
2475 The first two commands above will look for ".rsync-filter" in "/" and
2476 "/src" before the normal scan begins looking for the file in
2477 "/src/path" and its subdirectories. The last command avoids the par‐
2478 ent-dir scan and only looks for the ".rsync-filter" files in each
2479 directory that is a part of the transfer.
2480
2481 If you want to include the contents of a ".cvsignore" in your patterns,
2482 you should use the rule ":C", which creates a dir-merge of the .cvsig‐
2483 nore file, but parsed in a CVS-compatible manner. You can use this to
2484 affect where the --cvs-exclude (-C) option's inclusion of the per-
2485 directory .cvsignore file gets placed into your rules by putting the
2486 ":C" wherever you like in your filter rules. Without this, rsync would
2487 add the dir-merge rule for the .cvsignore file at the end of all your
2488 other rules (giving it a lower priority than your command-line rules).
2489 For example:
2490
2491 cat <<EOT | rsync -avC --filter='. -' a/ b
2492 + foo.o
2493 :C
2494 - *.old
2495 EOT
2496 rsync -avC --include=foo.o -f :C --exclude='*.old' a/ b
2497
2498
2499 Both of the above rsync commands are identical. Each one will merge
2500 all the per-directory .cvsignore rules in the middle of the list rather
2501 than at the end. This allows their dir-specific rules to supersede the
2502 rules that follow the :C instead of being subservient to all your
2503 rules. To affect the other CVS exclude rules (i.e. the default list of
2504 exclusions, the contents of $HOME/.cvsignore, and the value of $CVSIG‐
2505 NORE) you should omit the -C command-line option and instead insert a
2506 "-C" rule into your filter rules; e.g. "--filter=-C".
2507
2509 You can clear the current include/exclude list by using the "!" filter
2510 rule (as introduced in the FILTER RULES section above). The "current"
2511 list is either the global list of rules (if the rule is encountered
2512 while parsing the filter options) or a set of per-directory rules
2513 (which are inherited in their own sub-list, so a subdirectory can use
2514 this to clear out the parent's rules).
2515
2517 As mentioned earlier, global include/exclude patterns are anchored at
2518 the "root of the transfer" (as opposed to per-directory patterns, which
2519 are anchored at the merge-file's directory). If you think of the
2520 transfer as a subtree of names that are being sent from sender to
2521 receiver, the transfer-root is where the tree starts to be duplicated
2522 in the destination directory. This root governs where patterns that
2523 start with a / match.
2524
2525 Because the matching is relative to the transfer-root, changing the
2526 trailing slash on a source path or changing your use of the --relative
2527 option affects the path you need to use in your matching (in addition
2528 to changing how much of the file tree is duplicated on the destination
2529 host). The following examples demonstrate this.
2530
2531 Let's say that we want to match two source files, one with an absolute
2532 path of "/home/me/foo/bar", and one with a path of "/home/you/bar/baz".
2533 Here is how the various command choices differ for a 2-source transfer:
2534
2535 Example cmd: rsync -a /home/me /home/you /dest
2536 +/- pattern: /me/foo/bar
2537 +/- pattern: /you/bar/baz
2538 Target file: /dest/me/foo/bar
2539 Target file: /dest/you/bar/baz
2540
2541
2542 Example cmd: rsync -a /home/me/ /home/you/ /dest
2543 +/- pattern: /foo/bar (note missing "me")
2544 +/- pattern: /bar/baz (note missing "you")
2545 Target file: /dest/foo/bar
2546 Target file: /dest/bar/baz
2547
2548
2549 Example cmd: rsync -a --relative /home/me/ /home/you /dest
2550 +/- pattern: /home/me/foo/bar (note full path)
2551 +/- pattern: /home/you/bar/baz (ditto)
2552 Target file: /dest/home/me/foo/bar
2553 Target file: /dest/home/you/bar/baz
2554
2555
2556 Example cmd: cd /home; rsync -a --relative me/foo you/ /dest
2557 +/- pattern: /me/foo/bar (starts at specified path)
2558 +/- pattern: /you/bar/baz (ditto)
2559 Target file: /dest/me/foo/bar
2560 Target file: /dest/you/bar/baz
2561
2562
2563 The easiest way to see what name you should filter is to just look at
2564 the output when using --verbose and put a / in front of the name (use
2565 the --dry-run option if you're not yet ready to copy any files).
2566
2568 Without a delete option, per-directory rules are only relevant on the
2569 sending side, so you can feel free to exclude the merge files them‐
2570 selves without affecting the transfer. To make this easy, the 'e' mod‐
2571 ifier adds this exclude for you, as seen in these two equivalent com‐
2572 mands:
2573
2574 rsync -av --filter=': .excl' --exclude=.excl host:src/dir /dest
2575 rsync -av --filter=':e .excl' host:src/dir /dest
2576
2577
2578 However, if you want to do a delete on the receiving side AND you want
2579 some files to be excluded from being deleted, you'll need to be sure
2580 that the receiving side knows what files to exclude. The easiest way
2581 is to include the per-directory merge files in the transfer and use
2582 --delete-after, because this ensures that the receiving side gets all
2583 the same exclude rules as the sending side before it tries to delete
2584 anything:
2585
2586 rsync -avF --delete-after host:src/dir /dest
2587
2588
2589 However, if the merge files are not a part of the transfer, you'll need
2590 to either specify some global exclude rules (i.e. specified on the com‐
2591 mand line), or you'll need to maintain your own per-directory merge
2592 files on the receiving side. An example of the first is this (assume
2593 that the remote .rules files exclude themselves):
2594
2595 rsync -av --filter=': .rules' --filter='. /my/extra.rules'
2596 --delete host:src/dir /dest
2597
2598
2599 In the above example the extra.rules file can affect both sides of the
2600 transfer, but (on the sending side) the rules are subservient to the
2601 rules merged from the .rules files because they were specified after
2602 the per-directory merge rule.
2603
2604 In one final example, the remote side is excluding the .rsync-filter
2605 files from the transfer, but we want to use our own .rsync-filter files
2606 to control what gets deleted on the receiving side. To do this we must
2607 specifically exclude the per-directory merge files (so that they don't
2608 get deleted) and then put rules into the local files to control what
2609 else should not get deleted. Like one of these commands:
2610
2611 rsync -av --filter=':e /.rsync-filter' --delete \
2612 host:src/dir /dest
2613 rsync -avFF --delete host:src/dir /dest
2614
2615
2617 Batch mode can be used to apply the same set of updates to many identi‐
2618 cal systems. Suppose one has a tree which is replicated on a number of
2619 hosts. Now suppose some changes have been made to this source tree and
2620 those changes need to be propagated to the other hosts. In order to do
2621 this using batch mode, rsync is run with the write-batch option to
2622 apply the changes made to the source tree to one of the destination
2623 trees. The write-batch option causes the rsync client to store in a
2624 "batch file" all the information needed to repeat this operation
2625 against other, identical destination trees.
2626
2627 To apply the recorded changes to another destination tree, run rsync
2628 with the read-batch option, specifying the name of the same batch file,
2629 and the destination tree. Rsync updates the destination tree using the
2630 information stored in the batch file.
2631
2632 For convenience, one additional file is creating when the write-batch
2633 option is used. This file's name is created by appending ".sh" to the
2634 batch filename. The .sh file contains a command-line suitable for
2635 updating a destination tree using that batch file. It can be executed
2636 using a Bourne (or Bourne-like) shell, optionally passing in an alter‐
2637 nate destination tree pathname which is then used instead of the origi‐
2638 nal path. This is useful when the destination tree path differs from
2639 the original destination tree path.
2640
2641 Generating the batch file once saves having to perform the file status,
2642 checksum, and data block generation more than once when updating multi‐
2643 ple destination trees. Multicast transport protocols can be used to
2644 transfer the batch update files in parallel to many hosts at once,
2645 instead of sending the same data to every host individually.
2646
2647 Examples:
2648
2649 $ rsync --write-batch=foo -a host:/source/dir/ /adest/dir/
2650 $ scp foo* remote:
2651 $ ssh remote ./foo.sh /bdest/dir/
2652
2653
2654 $ rsync --write-batch=foo -a /source/dir/ /adest/dir/
2655 $ ssh remote rsync --read-batch=- -a /bdest/dir/ <foo
2656
2657
2658 In these examples, rsync is used to update /adest/dir/ from
2659 /source/dir/ and the information to repeat this operation is stored in
2660 "foo" and "foo.sh". The host "remote" is then updated with the batched
2661 data going into the directory /bdest/dir. The differences between the
2662 two examples reveals some of the flexibility you have in how you deal
2663 with batches:
2664
2665 o The first example shows that the initial copy doesn't have to be
2666 local -- you can push or pull data to/from a remote host using
2667 either the remote-shell syntax or rsync daemon syntax, as
2668 desired.
2669
2670 o The first example uses the created "foo.sh" file to get the
2671 right rsync options when running the read-batch command on the
2672 remote host.
2673
2674 o The second example reads the batch data via standard input so
2675 that the batch file doesn't need to be copied to the remote
2676 machine first. This example avoids the foo.sh script because it
2677 needed to use a modified --read-batch option, but you could edit
2678 the script file if you wished to make use of it (just be sure
2679 that no other option is trying to use standard input, such as
2680 the "--exclude-from=-" option).
2681
2682
2683 Caveats:
2684
2685 The read-batch option expects the destination tree that it is updating
2686 to be identical to the destination tree that was used to create the
2687 batch update fileset. When a difference between the destination trees
2688 is encountered the update might be discarded with a warning (if the
2689 file appears to be up-to-date already) or the file-update may be
2690 attempted and then, if the file fails to verify, the update discarded
2691 with an error. This means that it should be safe to re-run a read-
2692 batch operation if the command got interrupted. If you wish to force
2693 the batched-update to always be attempted regardless of the file's size
2694 and date, use the -I option (when reading the batch). If an error
2695 occurs, the destination tree will probably be in a partially updated
2696 state. In that case, rsync can be used in its regular (non-batch) mode
2697 of operation to fix up the destination tree.
2698
2699 The rsync version used on all destinations must be at least as new as
2700 the one used to generate the batch file. Rsync will die with an error
2701 if the protocol version in the batch file is too new for the batch-
2702 reading rsync to handle. See also the --protocol option for a way to
2703 have the creating rsync generate a batch file that an older rsync can
2704 understand. (Note that batch files changed format in version 2.6.3, so
2705 mixing versions older than that with newer versions will not work.)
2706
2707 When reading a batch file, rsync will force the value of certain
2708 options to match the data in the batch file if you didn't set them to
2709 the same as the batch-writing command. Other options can (and should)
2710 be changed. For instance --write-batch changes to --read-batch,
2711 --files-from is dropped, and the --filter/--include/--exclude options
2712 are not needed unless one of the --delete options is specified.
2713
2714 The code that creates the BATCH.sh file transforms any fil‐
2715 ter/include/exclude options into a single list that is appended as a
2716 "here" document to the shell script file. An advanced user can use
2717 this to modify the exclude list if a change in what gets deleted by
2718 --delete is desired. A normal user can ignore this detail and just use
2719 the shell script as an easy way to run the appropriate --read-batch
2720 command for the batched data.
2721
2722 The original batch mode in rsync was based on "rsync+", but the latest
2723 version uses a new implementation.
2724
2726 Three basic behaviors are possible when rsync encounters a symbolic
2727 link in the source directory.
2728
2729 By default, symbolic links are not transferred at all. A message
2730 "skipping non-regular" file is emitted for any symlinks that exist.
2731
2732 If --links is specified, then symlinks are recreated with the same tar‐
2733 get on the destination. Note that --archive implies --links.
2734
2735 If --copy-links is specified, then symlinks are "collapsed" by copying
2736 their referent, rather than the symlink.
2737
2738 rsync also distinguishes "safe" and "unsafe" symbolic links. An exam‐
2739 ple where this might be used is a web site mirror that wishes ensure
2740 the rsync module they copy does not include symbolic links to
2741 /etc/passwd in the public section of the site. Using
2742 --copy-unsafe-links will cause any links to be copied as the file they
2743 point to on the destination. Using --safe-links will cause unsafe
2744 links to be omitted altogether. (Note that you must specify --links
2745 for --safe-links to have any effect.)
2746
2747 Symbolic links are considered unsafe if they are absolute symlinks
2748 (start with /), empty, or if they contain enough ".." components to
2749 ascend from the directory being copied.
2750
2751 Here's a summary of how the symlink options are interpreted. The list
2752 is in order of precedence, so if your combination of options isn't men‐
2753 tioned, use the first line that is a complete subset of your options:
2754
2755 --copy-links
2756 Turn all symlinks into normal files (leaving no symlinks for any
2757 other options to affect).
2758
2759 --links --copy-unsafe-links
2760 Turn all unsafe symlinks into files and duplicate all safe sym‐
2761 links.
2762
2763 --copy-unsafe-links
2764 Turn all unsafe symlinks into files, noisily skip all safe sym‐
2765 links.
2766
2767 --links --safe-links
2768 Duplicate safe symlinks and skip unsafe ones.
2769
2770 --links
2771 Duplicate all symlinks.
2772
2774 rsync occasionally produces error messages that may seem a little cryp‐
2775 tic. The one that seems to cause the most confusion is "protocol ver‐
2776 sion mismatch -- is your shell clean?".
2777
2778 This message is usually caused by your startup scripts or remote shell
2779 facility producing unwanted garbage on the stream that rsync is using
2780 for its transport. The way to diagnose this problem is to run your
2781 remote shell like this:
2782
2783 ssh remotehost /bin/true > out.dat
2784
2785
2786 then look at out.dat. If everything is working correctly then out.dat
2787 should be a zero length file. If you are getting the above error from
2788 rsync then you will probably find that out.dat contains some text or
2789 data. Look at the contents and try to work out what is producing it.
2790 The most common cause is incorrectly configured shell startup scripts
2791 (such as .cshrc or .profile) that contain output statements for non-
2792 interactive logins.
2793
2794 If you are having trouble debugging filter patterns, then try specify‐
2795 ing the -vv option. At this level of verbosity rsync will show why
2796 each individual file is included or excluded.
2797
2799 0 Success
2800
2801 1 Syntax or usage error
2802
2803 2 Protocol incompatibility
2804
2805 3 Errors selecting input/output files, dirs
2806
2807 4 Requested action not supported: an attempt was made to manipu‐
2808 late 64-bit files on a platform that cannot support them; or an
2809 option was specified that is supported by the client and not by
2810 the server.
2811
2812 5 Error starting client-server protocol
2813
2814 6 Daemon unable to append to log-file
2815
2816 10 Error in socket I/O
2817
2818 11 Error in file I/O
2819
2820 12 Error in rsync protocol data stream
2821
2822 13 Errors with program diagnostics
2823
2824 14 Error in IPC code
2825
2826 20 Received SIGUSR1 or SIGINT
2827
2828 21 Some error returned by waitpid()
2829
2830 22 Error allocating core memory buffers
2831
2832 23 Partial transfer due to error
2833
2834 24 Partial transfer due to vanished source files
2835
2836 25 The --max-delete limit stopped deletions
2837
2838 30 Timeout in data send/receive
2839
2840
2842 CVSIGNORE
2843 The CVSIGNORE environment variable supplements any ignore pat‐
2844 terns in .cvsignore files. See the --cvs-exclude option for more
2845 details.
2846
2847 RSYNC_RSH
2848 The RSYNC_RSH environment variable allows you to override the
2849 default shell used as the transport for rsync. Command line
2850 options are permitted after the command name, just as in the -e
2851 option.
2852
2853 RSYNC_PROXY
2854 The RSYNC_PROXY environment variable allows you to redirect your
2855 rsync client to use a web proxy when connecting to a rsync dae‐
2856 mon. You should set RSYNC_PROXY to a hostname:port pair.
2857
2858 RSYNC_PASSWORD
2859 Setting RSYNC_PASSWORD to the required password allows you to
2860 run authenticated rsync connections to an rsync daemon without
2861 user intervention. Note that this does not supply a password to
2862 a shell transport such as ssh.
2863
2864 USER or LOGNAME
2865 The USER or LOGNAME environment variables are used to determine
2866 the default username sent to an rsync daemon. If neither is
2867 set, the username defaults to "nobody".
2868
2869 HOME The HOME environment variable is used to find the user's default
2870 .cvsignore file.
2871
2872
2874 /etc/rsyncd.conf or rsyncd.conf
2875
2877 rsyncd.conf(5)
2878
2880 times are transferred as *nix time_t values
2881
2882 When transferring to FAT filesystems rsync may re-sync unmodified
2883 files. See the comments on the --modify-window option.
2884
2885 file permissions, devices, etc. are transferred as native numerical
2886 values
2887
2888 see also the comments on the --delete option
2889
2890 Please report bugs! See the website at http://rsync.samba.org/
2891
2893 This man page is current for version 2.6.9 of rsync.
2894
2896 The options --server and --sender are used internally by rsync, and
2897 should never be typed by a user under normal circumstances. Some
2898 awareness of these options may be needed in certain scenarios, such as
2899 when setting up a login that can only run an rsync command. For
2900 instance, the support directory of the rsync distribution has an exam‐
2901 ple script named rrsync (for restricted rsync) that can be used with a
2902 restricted ssh login.
2903
2905 rsync is distributed under the GNU public license. See the file COPY‐
2906 ING for details.
2907
2908 A WEB site is available at http://rsync.samba.org/. The site includes
2909 an FAQ-O-Matic which may cover questions unanswered by this manual
2910 page.
2911
2912 The primary ftp site for rsync is ftp://rsync.samba.org/pub/rsync.
2913
2914 We would be delighted to hear from you if you like this program.
2915
2916 This program uses the excellent zlib compression library written by
2917 Jean-loup Gailly and Mark Adler.
2918
2920 Thanks to Richard Brent, Brendan Mackay, Bill Waite, Stephen Rothwell
2921 and David Bell for helpful suggestions, patches and testing of rsync.
2922 I've probably missed some people, my apologies if I have.
2923
2924 Especial thanks also to: David Dykstra, Jos Backus, Sebastian Krahmer,
2925 Martin Pool, Wayne Davison, J.W. Schultz.
2926
2928 rsync was originally written by Andrew Tridgell and Paul Mackerras.
2929 Many people have later contributed to it.
2930
2931 Mailing lists for support and development are available at
2932 http://lists.samba.org
2933
2934
2935
2936 6 Nov 2006 rsync(1)