OSDN Git Service

Add MS7619SE
[uclinux-h8/uClinux-dist.git] / user / rsync / rsync.1
1 .TH "rsync" "1" "28 Jul 2005" "" "" 
2 .SH "NAME" 
3 rsync \- faster, flexible replacement for rcp
4 .SH "SYNOPSIS" 
5 .PP 
6 rsync [OPTION]\&.\&.\&. SRC [SRC]\&.\&.\&. [USER@]HOST:DEST
7 .PP 
8 rsync [OPTION]\&.\&.\&. [USER@]HOST:SRC [DEST]
9 .PP 
10 rsync [OPTION]\&.\&.\&. SRC [SRC]\&.\&.\&. DEST
11 .PP 
12 rsync [OPTION]\&.\&.\&. [USER@]HOST::SRC [DEST]
13 .PP 
14 rsync [OPTION]\&.\&.\&. SRC [SRC]\&.\&.\&. [USER@]HOST::DEST
15 .PP 
16 rsync [OPTION]\&.\&.\&. rsync://[USER@]HOST[:PORT]/SRC [DEST]
17 .PP 
18 rsync [OPTION]\&.\&.\&. SRC [SRC]\&.\&.\&. rsync://[USER@]HOST[:PORT]/DEST
19 .PP 
20 .SH "DESCRIPTION" 
21 .PP 
22 rsync is a program that behaves in much the same way that rcp does,
23 but has many more options and uses the rsync remote-update protocol to
24 greatly speed up file transfers when the destination file is being
25 updated\&.
26 .PP 
27 The rsync remote-update protocol allows rsync to transfer just the
28 differences between two sets of files across the network connection, using
29 an efficient checksum-search algorithm described in the technical
30 report that accompanies this package\&.
31 .PP 
32 Some of the additional features of rsync are:
33 .PP 
34 .IP o 
35 support for copying links, devices, owners, groups, and permissions
36 .IP o 
37 exclude and exclude-from options similar to GNU tar
38 .IP o 
39 a CVS exclude mode for ignoring the same files that CVS would ignore
40 .IP o 
41 can use any transparent remote shell, including ssh or rsh
42 .IP o 
43 does not require root privileges
44 .IP o 
45 pipelining of file transfers to minimize latency costs
46 .IP o 
47 support for anonymous or authenticated rsync daemons (ideal for
48 mirroring)
49 .PP 
50 .SH "GENERAL" 
51 .PP 
52 Rsync copies files either to or from a remote host, or locally on the
53 current host (it does not support copying files between two remote hosts)\&.
54 .PP 
55 There are two different ways for rsync to contact a remote system: using a
56 remote-shell program as the transport (such as ssh or rsh) or contacting an
57 rsync daemon directly via TCP\&.  The remote-shell transport is used whenever
58 the source or destination path contains a single colon (:) separator after
59 a host specification\&.  Contacting an rsync daemon directly happens when the
60 source or destination path contains a double colon (::) separator after a
61 host specification, OR when an rsync:// URL is specified (see also the
62 "USING RSYNC-DAEMON FEATURES VIA A REMOTE-SHELL CONNECTION" section for
63 an exception to this latter rule)\&.
64 .PP 
65 As a special case, if a remote source is specified without a destination,
66 the remote files are listed in an output format similar to "ls -l"\&.
67 .PP 
68 As expected, if neither the source or destination path specify a remote
69 host, the copy occurs locally (see also the \fB--list-only\fP option)\&.
70 .PP 
71 .SH "SETUP" 
72 .PP 
73 See the file README for installation instructions\&.
74 .PP 
75 Once installed, you can use rsync to any machine that you can access via
76 a remote shell (as well as some that you can access using the rsync
77 daemon-mode protocol)\&.  For remote transfers, a modern rsync uses ssh
78 for its communications, but it may have been configured to use a
79 different remote shell by default, such as rsh or remsh\&.
80 .PP 
81 You can also specify any remote shell you like, either by using the \fB-e\fP
82 command line option, or by setting the RSYNC_RSH environment variable\&.
83 .PP 
84 One common substitute is to use ssh, which offers a high degree of
85 security\&.
86 .PP 
87 Note that rsync must be installed on both the source and destination
88 machines\&.
89 .PP 
90 .SH "USAGE" 
91 .PP 
92 You use rsync in the same way you use rcp\&. You must specify a source
93 and a destination, one of which may be remote\&.
94 .PP 
95 Perhaps the best way to explain the syntax is with some examples:
96 .PP 
97 .RS 
98 \f(CWrsync -t *\&.c foo:src/\fP
99 .RE 
100 .PP 
101 This would transfer all files matching the pattern *\&.c from the
102 current directory to the directory src on the machine foo\&. If any of
103 the files already exist on the remote system then the rsync
104 remote-update protocol is used to update the file by sending only the
105 differences\&. See the tech report for details\&.
106 .PP 
107 .RS 
108 \f(CWrsync -avz foo:src/bar /data/tmp\fP
109 .RE 
110 .PP 
111 This would recursively transfer all files from the directory src/bar on the
112 machine foo into the /data/tmp/bar directory on the local machine\&. The
113 files are transferred in "archive" mode, which ensures that symbolic
114 links, devices, attributes, permissions, ownerships, etc\&. are preserved
115 in the transfer\&.  Additionally, compression will be used to reduce the
116 size of data portions of the transfer\&.
117 .PP 
118 .RS 
119 \f(CWrsync -avz foo:src/bar/ /data/tmp\fP
120 .RE 
121 .PP 
122 A trailing slash on the source changes this behavior to avoid creating an
123 additional directory level at the destination\&.  You can think of a trailing
124 / on a source as meaning "copy the contents of this directory" as opposed
125 to "copy the directory by name", but in both cases the attributes of the
126 containing directory are transferred to the containing directory on the
127 destination\&.  In other words, each of the following commands copies the
128 files in the same way, including their setting of the attributes of
129 /dest/foo:
130 .PP 
131 .RS 
132 \f(CWrsync -av /src/foo /dest\fP
133 .br 
134 \f(CWrsync -av /src/foo/ /dest/foo\fP
135 .br 
136 .RE 
137 .PP 
138 Note also that host and module references don\&'t require a trailing slash to
139 copy the contents of the default directory\&.  For example, both of these
140 copy the remote directory\&'s contents into "/dest":
141 .PP 
142 .RS 
143 \f(CWrsync -av host: /dest\fP
144 .br 
145 \f(CWrsync -av host::module /dest\fP
146 .br 
147 .RE 
148 .PP 
149 You can also use rsync in local-only mode, where both the source and
150 destination don\&'t have a \&':\&' in the name\&. In this case it behaves like
151 an improved copy command\&.
152 .PP 
153 .RS 
154 \f(CWrsync somehost\&.mydomain\&.com::\fP
155 .RE 
156 .PP 
157 This would list all the anonymous rsync modules available on the host
158 somehost\&.mydomain\&.com\&.  (See the following section for more details\&.)
159 .PP 
160 .SH "ADVANCED USAGE" 
161 .PP 
162 The syntax for requesting multiple files from a remote host involves using
163 quoted spaces in the SRC\&.  Some examples:
164 .PP 
165 .RS 
166 \f(CWrsync host::\&'modname/dir1/file1 modname/dir2/file2\&' /dest\fP
167 .RE 
168 .PP 
169 This would copy file1 and file2 into /dest from an rsync daemon\&.  Each
170 additional arg must include the same "modname/" prefix as the first one,
171 and must be preceded by a single space\&.  All other spaces are assumed
172 to be a part of the filenames\&.
173 .PP 
174 .RS 
175 \f(CWrsync -av host:\&'dir1/file1 dir2/file2\&' /dest\fP
176 .RE 
177 .PP 
178 This would copy file1 and file2 into /dest using a remote shell\&.  This
179 word-splitting is done by the remote shell, so if it doesn\&'t work it means
180 that the remote shell isn\&'t configured to split its args based on
181 whitespace (a very rare setting, but not unknown)\&.  If you need to transfer
182 a filename that contains whitespace, you\&'ll need to either escape the
183 whitespace in a way that the remote shell will understand, or use wildcards
184 in place of the spaces\&.  Two examples of this are:
185 .PP 
186 .RS 
187 \f(CWrsync -av host:\&'file\e name\e with\e spaces\&' /dest\fP
188 .br 
189 \f(CWrsync -av host:file?name?with?spaces /dest\fP
190 .br 
191 .RE 
192 .PP 
193 This latter example assumes that your shell passes through unmatched
194 wildcards\&.  If it complains about "no match", put the name in quotes\&.
195 .PP 
196 .SH "CONNECTING TO AN RSYNC DAEMON" 
197 .PP 
198 It is also possible to use rsync without a remote shell as the transport\&.
199 In this case you will directly connect to a remote rsync daemon, typically
200 using TCP port 873\&.  (This obviously requires the daemon to be running on
201 the remote system, so refer to the STARTING AN RSYNC DAEMON TO ACCEPT
202 CONNECTIONS section below for information on that\&.)
203 .PP 
204 Using rsync in this way is the same as using it with a remote shell except
205 that:
206 .PP 
207 .IP o 
208 you either use a double colon :: instead of a single colon to
209 separate the hostname from the path, or you use an rsync:// URL\&.
210 .IP o 
211 the first word after the :: is a module name\&.
212 .IP o 
213 the remote daemon may print a message of the day when you
214 connect\&.
215 .IP o 
216 if you specify no path name on the remote daemon then the
217 list of accessible paths on the daemon will be shown\&.
218 .IP o 
219 if you specify no local destination then a listing of the
220 specified files on the remote daemon is provided\&.
221 .PP 
222 An example that copies all the files in a remote module named "src":
223 .PP 
224
225 .nf 
226  
227     rsync -av host::src /dest
228 .fi 
229  
230
231 .PP 
232 Some modules on the remote daemon may require authentication\&. If so,
233 you will receive a password prompt when you connect\&. You can avoid the
234 password prompt by setting the environment variable RSYNC_PASSWORD to
235 the password you want to use or using the \fB--password-file\fP option\&. This
236 may be useful when scripting rsync\&.
237 .PP 
238 WARNING: On some systems environment variables are visible to all
239 users\&. On those systems using \fB--password-file\fP is recommended\&.
240 .PP 
241 You may establish the connection via a web proxy by setting the
242 environment variable RSYNC_PROXY to a hostname:port pair pointing to
243 your web proxy\&.  Note that your web proxy\&'s configuration must support
244 proxy connections to port 873\&.
245 .PP 
246 .SH "USING RSYNC-DAEMON FEATURES VIA A REMOTE-SHELL CONNECTION" 
247 .PP 
248 It is sometimes useful to use various features of an rsync daemon (such as
249 named modules) without actually allowing any new socket connections into a
250 system (other than what is already required to allow remote-shell access)\&.
251 Rsync supports connecting to a host using a remote shell and then spawning
252 a single-use "daemon" server that expects to read its config file in the
253 home dir of the remote user\&.  This can be useful if you want to encrypt a
254 daemon-style transfer\&'s data, but since the daemon is started up fresh by
255 the remote user, you may not be able to use features such as chroot or
256 change the uid used by the daemon\&.  (For another way to encrypt a daemon
257 transfer, consider using ssh to tunnel a local port to a remote machine and
258 configure a normal rsync daemon on that remote host to only allow
259 connections from "localhost"\&.)
260 .PP 
261 From the user\&'s perspective, a daemon transfer via a remote-shell
262 connection uses nearly the same command-line syntax as a normal
263 rsync-daemon transfer, with the only exception being that you must
264 explicitly set the remote shell program on the command-line with the
265 \fB--rsh=COMMAND\fP option\&.  (Setting the RSYNC_RSH in the environment
266 will not turn on this functionality\&.)  For example:
267 .PP 
268
269 .nf 
270  
271     rsync -av --rsh=ssh host::module /dest
272 .fi 
273  
274
275 .PP 
276 If you need to specify a different remote-shell user, keep in mind that the
277 user@ prefix in front of the host is specifying the rsync-user value (for a
278 module that requires user-based authentication)\&.  This means that you must
279 give the \&'-l user\&' option to ssh when specifying the remote-shell:
280 .PP 
281
282 .nf 
283  
284     rsync -av -e "ssh -l ssh-user" rsync-user@host::module /dest
285 .fi 
286  
287
288 .PP 
289 The "ssh-user" will be used at the ssh level; the "rsync-user" will be
290 used to log-in to the "module"\&.
291 .PP 
292 .SH "STARTING AN RSYNC DAEMON TO ACCEPT CONNECTIONS" 
293 .PP 
294 In order to connect to an rsync daemon, the remote system needs to have a
295 daemon already running (or it needs to have configured something like inetd
296 to spawn an rsync daemon for incoming connections on a particular port)\&.
297 For full information on how to start a daemon that will handling incoming
298 socket connections, see the rsyncd\&.conf(5) man page -- that is the config
299 file for the daemon, and it contains the full details for how to run the
300 daemon (including stand-alone and inetd configurations)\&.
301 .PP 
302 If you\&'re using one of the remote-shell transports for the transfer, there is
303 no need to manually start an rsync daemon\&.
304 .PP 
305 .SH "EXAMPLES" 
306 .PP 
307 Here are some examples of how I use rsync\&.
308 .PP 
309 To backup my wife\&'s home directory, which consists of large MS Word
310 files and mail folders, I use a cron job that runs
311 .PP 
312 .RS 
313 \f(CWrsync -Cavz \&. arvidsjaur:backup\fP
314 .RE 
315 .PP 
316 each night over a PPP connection to a duplicate directory on my machine
317 "arvidsjaur"\&.
318 .PP 
319 To synchronize my samba source trees I use the following Makefile
320 targets:
321 .PP 
322
323 .nf 
324  
325     get:
326             rsync -avuzb --exclude \&'*~\&' samba:samba/ \&.
327     put:
328             rsync -Cavuzb \&. samba:samba/
329     sync: get put
330 .fi 
331  
332
333 .PP 
334 this allows me to sync with a CVS directory at the other end of the
335 connection\&. I then do CVS operations on the remote machine, which saves a
336 lot of time as the remote CVS protocol isn\&'t very efficient\&.
337 .PP 
338 I mirror a directory between my "old" and "new" ftp sites with the
339 command:
340 .PP 
341 \f(CWrsync -az -e ssh --delete ~ftp/pub/samba nimbus:"~ftp/pub/tridge"\fP
342 .PP 
343 This is launched from cron every few hours\&.
344 .PP 
345 .SH "OPTIONS SUMMARY" 
346 .PP 
347 Here is a short summary of the options available in rsync\&. Please refer
348 to the detailed description below for a complete description\&.  
349 .nf 
350  
351
352  -v, --verbose               increase verbosity
353  -q, --quiet                 suppress non-error messages
354  -c, --checksum              skip based on checksum, not mod-time & size
355  -a, --archive               archive mode; same as -rlptgoD (no -H)
356  -r, --recursive             recurse into directories
357  -R, --relative              use relative path names
358      --no-relative           turn off --relative
359      --no-implied-dirs       don\&'t send implied dirs with -R
360  -b, --backup                make backups (see --suffix & --backup-dir)
361      --backup-dir=DIR        make backups into hierarchy based in DIR
362      --suffix=SUFFIX         backup suffix (default ~ w/o --backup-dir)
363  -u, --update                skip files that are newer on the receiver
364      --inplace               update destination files in-place
365  -d, --dirs                  transfer directories without recursing
366  -l, --links                 copy symlinks as symlinks
367  -L, --copy-links            transform symlink into referent file/dir
368      --copy-unsafe-links     only "unsafe" symlinks are transformed
369      --safe-links            ignore symlinks that point outside the tree
370  -H, --hard-links            preserve hard links
371  -K, --keep-dirlinks         treat symlinked dir on receiver as dir
372  -p, --perms                 preserve permissions
373  -o, --owner                 preserve owner (root only)
374  -g, --group                 preserve group
375  -D, --devices               preserve devices (root only)
376  -t, --times                 preserve times
377  -O, --omit-dir-times        omit directories when preserving times
378  -S, --sparse                handle sparse files efficiently
379  -n, --dry-run               show what would have been transferred
380  -W, --whole-file            copy files whole (without rsync algorithm)
381      --no-whole-file         always use incremental rsync algorithm
382  -x, --one-file-system       don\&'t cross filesystem boundaries
383  -B, --block-size=SIZE       force a fixed checksum block-size
384  -e, --rsh=COMMAND           specify the remote shell to use
385      --rsync-path=PROGRAM    specify the rsync to run on remote machine
386      --existing              only update files that already exist
387      --ignore-existing       ignore files that already exist on receiver
388      --remove-sent-files     sent files/symlinks are removed from sender
389      --del                   an alias for --delete-during
390      --delete                delete files that don\&'t exist on sender
391      --delete-before         receiver deletes before transfer (default)
392      --delete-during         receiver deletes during xfer, not before
393      --delete-after          receiver deletes after transfer, not before
394      --delete-excluded       also delete excluded files on receiver
395      --ignore-errors         delete even if there are I/O errors
396      --force                 force deletion of dirs even if not empty
397      --max-delete=NUM        don\&'t delete more than NUM files
398      --max-size=SIZE         don\&'t transfer any file larger than SIZE
399      --partial               keep partially transferred files
400      --partial-dir=DIR       put a partially transferred file into DIR
401      --delay-updates         put all updated files into place at end
402      --numeric-ids           don\&'t map uid/gid values by user/group name
403      --timeout=TIME          set I/O timeout in seconds
404  -I, --ignore-times          don\&'t skip files that match size and time
405      --size-only             skip files that match in size
406      --modify-window=NUM     compare mod-times with reduced accuracy
407  -T, --temp-dir=DIR          create temporary files in directory DIR
408  -y, --fuzzy                 find similar file for basis if no dest file
409      --compare-dest=DIR      also compare received files relative to DIR
410      --copy-dest=DIR         \&.\&.\&. and include copies of unchanged files
411      --link-dest=DIR         hardlink to files in DIR when unchanged
412  -z, --compress              compress file data during the transfer
413  -C, --cvs-exclude           auto-ignore files in the same way CVS does
414  -f, --filter=RULE           add a file-filtering RULE
415  -F                          same as --filter=\&'dir-merge /\&.rsync-filter\&'
416                              repeated: --filter=\&'- \&.rsync-filter\&'
417      --exclude=PATTERN       exclude files matching PATTERN
418      --exclude-from=FILE     read exclude patterns from FILE
419      --include=PATTERN       don\&'t exclude files matching PATTERN
420      --include-from=FILE     read include patterns from FILE
421      --files-from=FILE       read list of source-file names from FILE
422  -0, --from0                 all *from/filter files are delimited by 0s
423      --address=ADDRESS       bind address for outgoing socket to daemon
424      --port=PORT             specify double-colon alternate port number
425      --blocking-io           use blocking I/O for the remote shell
426      --no-blocking-io        turn off blocking I/O when it is default
427      --stats                 give some file-transfer stats
428      --progress              show progress during transfer
429  -P                          same as --partial --progress
430  -i, --itemize-changes       output a change-summary for all updates
431      --log-format=FORMAT     output filenames using the specified format
432      --password-file=FILE    read password from FILE
433      --list-only             list the files instead of copying them
434      --bwlimit=KBPS          limit I/O bandwidth; KBytes per second
435      --write-batch=FILE      write a batched update to FILE
436      --only-write-batch=FILE like --write-batch but w/o updating dest
437      --read-batch=FILE       read a batched update from FILE
438      --protocol=NUM          force an older protocol version to be used
439      --checksum-seed=NUM     set block/file checksum seed (advanced)
440  -4, --ipv4                  prefer IPv4
441  -6, --ipv6                  prefer IPv6
442      --version               print version number
443  -h, --help                  show this help screen
444 .fi 
445  
446
447 .PP 
448 Rsync can also be run as a daemon, in which case the following options are
449 accepted: 
450 .nf 
451  
452
453      --daemon                run as an rsync daemon
454      --address=ADDRESS       bind to the specified address
455      --bwlimit=KBPS          limit I/O bandwidth; KBytes per second
456      --config=FILE           specify alternate rsyncd\&.conf file
457      --no-detach             do not detach from the parent
458      --port=PORT             listen on alternate port number
459  -v, --verbose               increase verbosity
460  -4, --ipv4                  prefer IPv4
461  -6, --ipv6                  prefer IPv6
462  -h, --help                  show this help screen
463 .fi 
464  
465
466 .PP 
467 .SH "OPTIONS" 
468 .PP 
469 rsync uses the GNU long options package\&. Many of the command line
470 options have two variants, one short and one long\&.  These are shown
471 below, separated by commas\&. Some options only have a long variant\&.
472 The \&'=\&' for options that take a parameter is optional; whitespace
473 can be used instead\&.
474 .PP 
475 .IP "\fB-h, --help\fP" 
476 Print a short help page describing the options
477 available in rsync\&.
478 .IP 
479 .IP "\fB--version\fP" 
480 print the rsync version number and exit\&.
481 .IP 
482 .IP "\fB-v, --verbose\fP" 
483 This option increases the amount of information you
484 are given during the transfer\&.  By default, rsync works silently\&. A
485 single \fB-v\fP will give you information about what files are being
486 transferred and a brief summary at the end\&. Two \fB-v\fP flags will give you
487 information on what files are being skipped and slightly more
488 information at the end\&. More than two \fB-v\fP flags should only be used if
489 you are debugging rsync\&.
490 .IP 
491 Note that the names of the transferred files that are output are done using
492 a default \fB--log-format\fP of "%n%L", which tells you just the name of the
493 file and, if the item is a link, where it points\&.  At the single \fB-v\fP
494 level of verbosity, this does not mention when a file gets its attributes
495 changed\&.  If you ask for an itemized list of changed attributes (either
496 \fB--itemize-changes\fP or adding "%i" to the \fB--log-format\fP setting), the
497 output (on the client) increases to mention all items that are changed in
498 any way\&.  See the \fB--log-format\fP option for more details\&.
499 .IP 
500 .IP "\fB-q, --quiet\fP" 
501 This option decreases the amount of information you
502 are given during the transfer, notably suppressing information messages
503 from the remote server\&. This flag is useful when invoking rsync from
504 cron\&.
505 .IP 
506 .IP "\fB-I, --ignore-times\fP" 
507 Normally rsync will skip any files that are
508 already the same size and have the same modification time-stamp\&.
509 This option turns off this "quick check" behavior\&.
510 .IP 
511 .IP "\fB--size-only\fP" 
512 Normally rsync will not transfer any files that are
513 already the same size and have the same modification time-stamp\&. With the
514 \fB--size-only\fP option, files will not be transferred if they have the same size,
515 regardless of timestamp\&. This is useful when starting to use rsync
516 after using another mirroring system which may not preserve timestamps
517 exactly\&.
518 .IP 
519 .IP "\fB--modify-window\fP" 
520 When comparing two timestamps, rsync treats the
521 timestamps as being equal if they differ by no more than the modify-window
522 value\&.  This is normally 0 (for an exact match), but you may find it useful
523 to set this to a larger value in some situations\&.  In particular, when
524 transferring to or from an MS Windows FAT filesystem (which represents
525 times with a 2-second resolution), \fB--modify-window=1\fP is useful
526 (allowing times to differ by up to 1 second)\&.
527 .IP 
528 .IP "\fB-c, --checksum\fP" 
529 This forces the sender to checksum all files using
530 a 128-bit MD4 checksum before transfer\&. The checksum is then
531 explicitly checked on the receiver and any files of the same name
532 which already exist and have the same checksum and size on the
533 receiver are not transferred\&.  This option can be quite slow\&.
534 .IP 
535 .IP "\fB-a, --archive\fP" 
536 This is equivalent to \fB-rlptgoD\fP\&. It is a quick
537 way of saying you want recursion and want to preserve almost
538 everything\&.  The only exception to this is if \fB--files-from\fP was
539 specified, in which case \fB-r\fP is not implied\&.
540 .IP 
541 Note that \fB-a\fP \fBdoes not preserve hardlinks\fP, because
542 finding multiply-linked files is expensive\&.  You must separately
543 specify \fB-H\fP\&.
544 .IP 
545 .IP "\fB-r, --recursive\fP" 
546 This tells rsync to copy directories
547 recursively\&.  See also \fB--dirs\fP (\fB-d\fP)\&.
548 .IP 
549 .IP "\fB-R, --relative\fP" 
550 Use relative paths\&. This means that the full path
551 names specified on the command line are sent to the server rather than
552 just the last parts of the filenames\&. This is particularly useful when
553 you want to send several different directories at the same time\&. For
554 example, if you used the command
555 .IP 
556 .RS 
557 \f(CW   rsync /foo/bar/foo\&.c remote:/tmp/\fP
558 .RE 
559 .IP 
560 then this would create a file called foo\&.c in /tmp/ on the remote
561 machine\&. If instead you used
562 .IP 
563 .RS 
564 \f(CW   rsync -R /foo/bar/foo\&.c remote:/tmp/\fP
565 .RE 
566 .IP 
567 then a file called /tmp/foo/bar/foo\&.c would be created on the remote
568 machine -- the full path name is preserved\&.  To limit the amount of
569 path information that is sent, do something like this:
570 .IP 
571 .RS 
572 \f(CW   cd /foo\fP
573 .br 
574 \f(CW   rsync -R bar/foo\&.c remote:/tmp/\fP
575 .br 
576 .RE 
577 .IP 
578 That would create /tmp/bar/foo\&.c on the remote machine\&.
579 .IP 
580 .IP "\fB--no-relative\fP" 
581 Turn off the \fB--relative\fP option\&.  This is only
582 needed if you want to use \fB--files-from\fP without its implied \fB--relative\fP
583 file processing\&.
584 .IP 
585 .IP "\fB--no-implied-dirs\fP" 
586 When combined with the \fB--relative\fP option, the
587 implied directories in each path are not explicitly duplicated as part
588 of the transfer\&.  This makes the transfer more optimal and also allows
589 the two sides to have non-matching symlinks in the implied part of the
590 path\&.  For instance, if you transfer the file "/path/foo/file" with \fB-R\fP,
591 the default is for rsync to ensure that "/path" and "/path/foo" on the
592 destination exactly match the directories/symlinks of the source\&.  Using
593 the \fB--no-implied-dirs\fP option would omit both of these implied dirs,
594 which means that if "/path" was a real directory on one machine and a
595 symlink of the other machine, rsync would not try to change this\&.
596 .IP 
597 .IP "\fB-b, --backup\fP" 
598 With this option, preexisting destination files are
599 renamed as each file is transferred or deleted\&.  You can control where the
600 backup file goes and what (if any) suffix gets appended using the
601 \fB--backup-dir\fP and \fB--suffix\fP options\&.
602 Note that if you don\&'t specify \fB--backup-dir\fP, the \fB--omit-dir-times\fP
603 option will be enabled\&.
604 .IP 
605 .IP "\fB--backup-dir=DIR\fP" 
606 In combination with the \fB--backup\fP option, this
607 tells rsync to store all backups in the specified directory\&. This is
608 very useful for incremental backups\&.  You can additionally
609 specify a backup suffix using the \fB--suffix\fP option
610 (otherwise the files backed up in the specified directory
611 will keep their original filenames)\&.
612 .IP 
613 .IP "\fB--suffix=SUFFIX\fP" 
614 This option allows you to override the default
615 backup suffix used with the \fB--backup\fP (\fB-b\fP) option\&. The default suffix is a ~
616 if no -\fB-backup-dir\fP was specified, otherwise it is an empty string\&.
617 .IP 
618 .IP "\fB-u, --update\fP" 
619 This forces rsync to skip any files which exist on
620 the destination and have a modified time that is newer than the source
621 file\&.  (If an existing destination file has a modify time equal to the
622 source file\&'s, it will be updated if the sizes are different\&.)
623 .IP 
624 In the current implementation of \fB--update\fP, a difference of file format
625 between the sender and receiver is always
626 considered to be important enough for an update, no matter what date
627 is on the objects\&.  In other words, if the source has a directory or a
628 symlink where the destination has a file, the transfer would occur
629 regardless of the timestamps\&.  This might change in the future (feel
630 free to comment on this on the mailing list if you have an opinion)\&.
631 .IP 
632 .IP "\fB--inplace\fP" 
633 This causes rsync not to create a new copy of the file
634 and then move it into place\&.  Instead rsync will overwrite the existing
635 file, meaning that the rsync algorithm can\&'t accomplish the full amount of
636 network reduction it might be able to otherwise (since it does not yet try
637 to sort data matches)\&.  One exception to this is if you combine the option
638 with \fB--backup\fP, since rsync is smart enough to use the backup file as the
639 basis file for the transfer\&.
640 .IP 
641 This option is useful for transfer of large files with block-based changes
642 or appended data, and also on systems that are disk bound, not network
643 bound\&.
644 .IP 
645 The option implies \fB--partial\fP (since an interrupted transfer does not delete
646 the file), but conflicts with \fB--partial-dir\fP and \fB--delay-updates\fP\&.
647 Prior to rsync 2\&.6\&.4 \fB--inplace\fP was also incompatible with \fB--compare-dest\fP
648 and \fB--link-dest\fP\&.
649 .IP 
650 WARNING: The file\&'s data will be in an inconsistent state during the
651 transfer (and possibly afterward if the transfer gets interrupted), so you
652 should not use this option to update files that are in use\&.  Also note that
653 rsync will be unable to update a file in-place that is not writable by the
654 receiving user\&.
655 .IP 
656 .IP "\fB-d, --dirs\fP" 
657 Tell the sending side to include any directories that
658 are encountered\&.  Unlike \fB--recursive\fP, a directory\&'s contents are not copied
659 unless the directory was specified on the command-line as either "\&." or a
660 name with a trailing slash (e\&.g\&. "foo/")\&.  Without this option or the
661 \fB--recursive\fP option, rsync will skip all directories it encounters (and
662 output a message to that effect for each one)\&.
663 .IP 
664 .IP "\fB-l, --links\fP" 
665 When symlinks are encountered, recreate the
666 symlink on the destination\&.
667 .IP 
668 .IP "\fB-L, --copy-links\fP" 
669 When symlinks are encountered, the file that
670 they point to (the referent) is copied, rather than the symlink\&.  In older
671 versions of rsync, this option also had the side-effect of telling the
672 receiving side to follow symlinks, such as symlinks to directories\&.  In a
673 modern rsync such as this one, you\&'ll need to specify \fB--keep-dirlinks\fP (\fB-K\fP)
674 to get this extra behavior\&.  The only exception is when sending files to
675 an rsync that is too old to understand \fB-K\fP -- in that case, the \fB-L\fP option
676 will still have the side-effect of \fB-K\fP on that older receiving rsync\&.
677 .IP 
678 .IP "\fB--copy-unsafe-links\fP" 
679 This tells rsync to copy the referent of
680 symbolic links that point outside the copied tree\&.  Absolute symlinks
681 are also treated like ordinary files, and so are any symlinks in the
682 source path itself when \fB--relative\fP is used\&.
683 .IP 
684 .IP "\fB--safe-links\fP" 
685 This tells rsync to ignore any symbolic links
686 which point outside the copied tree\&. All absolute symlinks are
687 also ignored\&. Using this option in conjunction with \fB--relative\fP may
688 give unexpected results\&.
689 .IP 
690 .IP "\fB-H, --hard-links\fP" 
691 This tells rsync to recreate hard  links  on
692 the  remote system  to  be the same as the local system\&. Without this
693 option hard links are treated like regular files\&.
694 .IP 
695 Note that rsync can only detect hard links if both parts of the link
696 are in the list of files being sent\&.
697 .IP 
698 This option can be quite slow, so only use it if you need it\&.
699 .IP 
700 .IP "\fB-K, --keep-dirlinks\fP" 
701 On the receiving side, if a symlink is
702 pointing to a directory, it will be treated as matching a directory
703 from the sender\&.
704 .IP 
705 .IP "\fB-W, --whole-file\fP" 
706 With this option the incremental rsync algorithm
707 is not used and the whole file is sent as-is instead\&.  The transfer may be
708 faster if this option is used when the bandwidth between the source and
709 destination machines is higher than the bandwidth to disk (especially when the
710 "disk" is actually a networked filesystem)\&.  This is the default when both
711 the source and destination are specified as local paths\&.
712 .IP 
713 .IP "\fB--no-whole-file\fP" 
714 Turn off \fB--whole-file\fP, for use when it is the
715 default\&.
716 .IP 
717 .IP "\fB-p, --perms\fP" 
718 This option causes rsync to set the destination
719 permissions to be the same as the source permissions\&.
720 .IP 
721 Without this option, all existing files (including updated files) retain
722 their existing permissions, while each new file gets its permissions set
723 based on the source file\&'s permissions, but masked by the receiving end\&'s
724 umask setting
725 (which is the same behavior as other file-copy utilities, such as cp)\&.
726 .IP 
727 .IP "\fB-o, --owner\fP" 
728 This option causes rsync to set the owner of the
729 destination file to be the same as the source file\&.  On most systems,
730 only the super-user can set file ownership\&.  By default, the preservation
731 is done by name, but may fall back to using the ID number in some
732 circumstances\&.  See the \fB--numeric-ids\fP option for a full discussion\&.
733 .IP 
734 .IP "\fB-g, --group\fP" 
735 This option causes rsync to set the group of the
736 destination file to be the same as the source file\&.  If the receiving
737 program is not running as the super-user, only groups that the
738 receiver is a member of will be preserved\&.  By default, the preservation
739 is done by name, but may fall back to using the ID number in some
740 circumstances\&.  See the \fB--numeric-ids\fP option for a full discussion\&.
741 .IP 
742 .IP "\fB-D, --devices\fP" 
743 This option causes rsync to transfer character and
744 block device information to the remote system to recreate these
745 devices\&. This option is only available to the super-user\&.
746 .IP 
747 .IP "\fB-t, --times\fP" 
748 This tells rsync to transfer modification times along
749 with the files and update them on the remote system\&.  Note that if this
750 option is not used, the optimization that excludes files that have not been
751 modified cannot be effective; in other words, a missing \fB-t\fP or \fB-a\fP will
752 cause the next transfer to behave as if it used \fB-I\fP, causing all files to be
753 updated (though the rsync algorithm will make the update fairly efficient
754 if the files haven\&'t actually changed, you\&'re much better off using \fB-t\fP)\&.
755 .IP 
756 .IP "\fB-O, --omit-dir-times\fP" 
757 This tells rsync to omit directories when
758 it is preserving modification times (see \fB--times\fP)\&.  If NFS is sharing
759 the directories on the receiving side, it is a good idea to use \fB-O\fP\&.
760 This option is inferred if you use \fB--backup\fP without \fB--backup-dir\fP\&.
761 .IP 
762 .IP "\fB-n, --dry-run\fP" 
763 This tells rsync to not do any file transfers,
764 instead it will just report the actions it would have taken\&.
765 .IP 
766 .IP "\fB-S, --sparse\fP" 
767 Try to handle sparse files efficiently so they take
768 up less space on the destination\&.
769 .IP 
770 NOTE: Don\&'t use this option when the destination is a Solaris "tmpfs"
771 filesystem\&. It doesn\&'t seem to handle seeks over null regions
772 correctly and ends up corrupting the files\&.
773 .IP 
774 .IP "\fB-x, --one-file-system\fP" 
775 This tells rsync not to cross filesystem
776 boundaries  when recursing\&.  This  is useful for transferring the
777 contents of only one filesystem\&.
778 .IP 
779 .IP "\fB--existing\fP" 
780 This tells rsync not to create any new files --
781 only update files that already exist on the destination\&.
782 .IP 
783 .IP "\fB--ignore-existing\fP" 
784 This tells rsync not to update files that already exist on
785 the destination\&.
786 .IP 
787 .IP "\fB--remove-sent-files\fP" 
788 This tells rsync to remove from the sending
789 side the files and/or symlinks that are newly created or whose content is
790 updated on the receiving side\&.  Directories and devices are not removed,
791 nor are files/symlinks whose attributes are merely changed\&.
792 .IP 
793 .IP "\fB--delete\fP" 
794 This tells rsync to delete extraneous files from the
795 receiving side (ones that aren\&'t on the sending side), but only for the
796 directories that are being synchronized\&.  You must have asked rsync to
797 send the whole directory (e\&.g\&. "dir" or "dir/") without using a wildcard
798 for the directory\&'s contents (e\&.g\&. "dir/*") since the wildcard is expanded
799 by the shell and rsync thus gets a request to transfer individual files, not
800 the files\&' parent directory\&.  Files that are excluded from transfer are
801 also excluded from being deleted unless you use the \fB--delete-excluded\fP
802 option or mark the rules as only matching on the sending side (see the
803 include/exclude modifiers in the FILTER RULES section)\&.
804 .IP 
805 This option has no effect unless directory recursion is enabled\&.
806 .IP 
807 This option can be dangerous if used incorrectly!  It is a very good idea
808 to run first using the \fB--dry-run\fP option (\fB-n\fP) to see what files would be
809 deleted to make sure important files aren\&'t listed\&.
810 .IP 
811 If the sending side detects any I/O errors, then the deletion of any
812 files at the destination will be automatically disabled\&. This is to
813 prevent temporary filesystem failures (such as NFS errors) on the
814 sending side causing a massive deletion of files on the
815 destination\&.  You can override this with the \fB--ignore-errors\fP option\&.
816 .IP 
817 The \fB--delete\fP option may be combined with one of the --delete-WHEN options
818 without conflict, as well as \fB--delete-excluded\fP\&.  However, if none of the
819 --delete-WHEN options are specified, rsync will currently choose the
820 \fB--delete-before\fP algorithm\&.  A future version may change this to choose the
821 \fB--delete-during\fP algorithm\&.  See also \fB--delete-after\fP\&.
822 .IP 
823 .IP "\fB--delete-before\fP" 
824 Request that the file-deletions on the receiving
825 side be done before the transfer starts\&.  This is the default if \fB--delete\fP
826 or \fB--delete-excluded\fP is specified without one of the --delete-WHEN options\&.
827 See \fB--delete\fP (which is implied) for more details on file-deletion\&.
828 .IP 
829 Deleting before the transfer is helpful if the filesystem is tight for space
830 and removing extraneous files would help to make the transfer possible\&.
831 However, it does introduce a delay before the start of the transfer,
832 and this delay might cause the transfer to timeout (if \fB--timeout\fP was
833 specified)\&.
834 .IP 
835 .IP "\fB--delete-during, --del\fP" 
836 Request that the file-deletions on the
837 receiving side be done incrementally as the transfer happens\&.  This is
838 a faster method than choosing the before- or after-transfer algorithm,
839 but it is only supported beginning with rsync version 2\&.6\&.4\&.
840 See \fB--delete\fP (which is implied) for more details on file-deletion\&.
841 .IP 
842 .IP "\fB--delete-after\fP" 
843 Request that the file-deletions on the receiving
844 side be done after the transfer has completed\&.  This is useful if you
845 are sending new per-directory merge files as a part of the transfer and
846 you want their exclusions to take effect for the delete phase of the
847 current transfer\&.
848 See \fB--delete\fP (which is implied) for more details on file-deletion\&.
849 .IP 
850 .IP "\fB--delete-excluded\fP" 
851 In addition to deleting the files on the
852 receiving side that are not on the sending side, this tells rsync to also
853 delete any files on the receiving side that are excluded (see \fB--exclude\fP)\&.
854 See the FILTER RULES section for a way to make individual exclusions behave
855 this way on the receiver, and for a way to protect files from
856 \fB--delete-excluded\fP\&.
857 See \fB--delete\fP (which is implied) for more details on file-deletion\&.
858 .IP 
859 .IP "\fB--ignore-errors\fP" 
860 Tells \fB--delete\fP to go ahead and delete files
861 even when there are I/O errors\&.
862 .IP 
863 .IP "\fB--force\fP" 
864 This options tells rsync to delete directories even if
865 they are not empty when they are to be replaced by non-directories\&.  This
866 is only relevant without \fB--delete\fP because deletions are now done depth-first\&.
867 Requires the \fB--recursive\fP option (which is implied by \fB-a\fP) to have any effect\&.
868 .IP 
869 .IP "\fB--max-delete=NUM\fP" 
870 This tells rsync not to delete more than NUM
871 files or directories (NUM must be non-zero)\&.
872 This is useful when mirroring very large trees to prevent disasters\&.
873 .IP 
874 .IP "\fB--max-size=SIZE\fP" 
875 This tells rsync to avoid transferring any
876 file that is larger than the specified SIZE\&. The SIZE value can be
877 suffixed with a letter to indicate a size multiplier (K, M, or G) and
878 may be a fractional value (e\&.g\&. "\fB--max-size=1\&.5m\fP")\&.
879 .IP 
880 .IP "\fB-B, --block-size=BLOCKSIZE\fP" 
881 This forces the block size used in
882 the rsync algorithm to a fixed value\&.  It is normally selected based on
883 the size of each file being updated\&.  See the technical report for details\&.
884 .IP 
885 .IP "\fB-e, --rsh=COMMAND\fP" 
886 This option allows you to choose an alternative
887 remote shell program to use for communication between the local and
888 remote copies of rsync\&. Typically, rsync is configured to use ssh by
889 default, but you may prefer to use rsh on a local network\&.
890 .IP 
891 If this option is used with \fB[user@]host::module/path\fP, then the
892 remote shell \fICOMMAND\fP will be used to run an rsync daemon on the
893 remote host, and all data will be transmitted through that remote
894 shell connection, rather than through a direct socket connection to a
895 running rsync daemon on the remote host\&.  See the section "USING
896 RSYNC-DAEMON FEATURES VIA A REMOTE-SHELL CONNECTION" above\&.
897 .IP 
898 Command-line arguments are permitted in COMMAND provided that COMMAND is
899 presented to rsync as a single argument\&.  For example:
900 .IP 
901 .RS 
902 \f(CW   -e "ssh -p 2234"\fP
903 .RE 
904 .IP 
905 (Note that ssh users can alternately customize site-specific connect
906 options in their \&.ssh/config file\&.)
907 .IP 
908 You can also choose the remote shell program using the RSYNC_RSH
909 environment variable, which accepts the same range of values as \fB-e\fP\&.
910 .IP 
911 See also the \fB--blocking-io\fP option which is affected by this option\&.
912 .IP 
913 .IP "\fB--rsync-path=PROGRAM\fP" 
914 Use this to specify what program is to be run
915 on the remote machine to start-up rsync\&.  Often used when rsync is not in
916 the default remote-shell\&'s path (e\&.g\&. --rsync-path=/usr/local/bin/rsync)\&.
917 Note that PROGRAM is run with the help of a shell, so it can be any
918 program, script, or command sequence you\&'d care to run, so long as it does
919 not corrupt the standard-in & standard-out that rsync is using to
920 communicate\&.
921 .IP 
922 One tricky example is to set a different default directory on the remote
923 machine for use with the \fB--relative\fP option\&.  For instance:
924 .IP 
925 .RS 
926 \f(CW    rsync -avR --rsync-path="cd /a/b && rsync" hst:c/d /e/\fP
927 .RE 
928 .IP 
929 .IP "\fB-C, --cvs-exclude\fP" 
930 This is a useful shorthand for excluding a
931 broad range of files that you often don\&'t want to transfer between
932 systems\&. It uses the same algorithm that CVS uses to determine if
933 a file should be ignored\&.
934 .IP 
935 The exclude list is initialized to:
936 .IP 
937 .RS 
938 .RS 
939 \f(CWRCS SCCS CVS CVS\&.adm RCSLOG cvslog\&.* tags TAGS \&.make\&.state
940 \&.nse_depinfo *~ #* \&.#* ,* _$* *$ *\&.old *\&.bak *\&.BAK *\&.orig *\&.rej
941 \&.del-* *\&.a *\&.olb *\&.o *\&.obj *\&.so *\&.exe *\&.Z *\&.elc *\&.ln core \&.svn/\fP
942 .RE 
943 .RE 
944 .IP 
945 then files listed in a $HOME/\&.cvsignore are added to the list and any
946 files listed in the CVSIGNORE environment variable (all cvsignore names
947 are delimited by whitespace)\&.
948 .IP 
949 Finally, any file is ignored if it is in the same directory as a
950 \&.cvsignore file and matches one of the patterns listed therein\&.  Unlike
951 rsync\&'s filter/exclude files, these patterns are split on whitespace\&.
952 See the \fBcvs(1)\fP manual for more information\&.
953 .IP 
954 If you\&'re combining \fB-C\fP with your own \fB--filter\fP rules, you should
955 note that these CVS excludes are appended at the end of your own rules,
956 regardless of where the \fB-C\fP was placed on the command-line\&.  This makes them
957 a lower priority than any rules you specified explicitly\&.  If you want to
958 control where these CVS excludes get inserted into your filter rules, you
959 should omit the \fB-C\fP as a command-line option and use a combination of
960 \fB--filter=:C\fP and \fB--filter=-C\fP (either on your command-line or by
961 putting the ":C" and "-C" rules into a filter file with your other rules)\&.
962 The first option turns on the per-directory scanning for the \&.cvsignore
963 file\&.  The second option does a one-time import of the CVS excludes
964 mentioned above\&.
965 .IP 
966 .IP "\fB-f, --filter=RULE\fP" 
967 This option allows you to add rules to selectively
968 exclude certain files from the list of files to be transferred\&. This is
969 most useful in combination with a recursive transfer\&.
970 .IP 
971 You may use as many \fB--filter\fP options on the command line as you like
972 to build up the list of files to exclude\&.
973 .IP 
974 See the FILTER RULES section for detailed information on this option\&.
975 .IP 
976 .IP "\fB-F\fP" 
977 The \fB-F\fP option is a shorthand for adding two \fB--filter\fP rules to
978 your command\&.  The first time it is used is a shorthand for this rule:
979 .IP 
980 .RS 
981 \f(CW   --filter=\&': /\&.rsync-filter\&'\fP
982 .RE 
983 .IP 
984 This tells rsync to look for per-directory \&.rsync-filter files that have
985 been sprinkled through the hierarchy and use their rules to filter the
986 files in the transfer\&.  If \fB-F\fP is repeated, it is a shorthand for this
987 rule:
988 .IP 
989 .RS 
990 \f(CW   --filter=\&'- \&.rsync-filter\&'\fP
991 .RE 
992 .IP 
993 This filters out the \&.rsync-filter files themselves from the transfer\&.
994 .IP 
995 See the FILTER RULES section for detailed information on how these options
996 work\&.
997 .IP 
998 .IP "\fB--exclude=PATTERN\fP" 
999 This option is a simplified form of the
1000 \fB--filter\fP option that defaults to an exclude rule and does not allow
1001 the full rule-parsing syntax of normal filter rules\&.
1002 .IP 
1003 See the FILTER RULES section for detailed information on this option\&.
1004 .IP 
1005 .IP "\fB--exclude-from=FILE\fP" 
1006 This option is similar to the \fB--exclude\fP
1007 option, but instead it adds all exclude patterns listed in the file
1008 FILE to the exclude list\&.  Blank lines in FILE and lines starting with
1009 \&';\&' or \&'#\&' are ignored\&.
1010 If \fIFILE\fP is \fB-\fP the list will be read from standard input\&.
1011 .IP 
1012 .IP "\fB--include=PATTERN\fP" 
1013 This option is a simplified form of the
1014 \fB--filter\fP option that defaults to an include rule and does not allow
1015 the full rule-parsing syntax of normal filter rules\&.
1016 .IP 
1017 See the FILTER RULES section for detailed information on this option\&.
1018 .IP 
1019 .IP "\fB--include-from=FILE\fP" 
1020 This specifies a list of include patterns
1021 from a file\&.
1022 If \fIFILE\fP is "-" the list will be read from standard input\&.
1023 .IP 
1024 .IP "\fB--files-from=FILE\fP" 
1025 Using this option allows you to specify the
1026 exact list of files to transfer (as read from the specified FILE or "-"
1027 for standard input)\&.  It also tweaks the default behavior of rsync to make
1028 transferring just the specified files and directories easier:
1029 .IP 
1030 .RS 
1031 .IP o 
1032 The \fB--relative\fP (\fB-R\fP) option is implied, which preserves the path
1033 information that is specified for each item in the file (use
1034 \fB--no-relative\fP if you want to turn that off)\&.
1035 .IP o 
1036 The \fB--dirs\fP (\fB-d\fP) option is implied, which will create directories
1037 specified in the list on the destination rather than noisily skipping
1038 them\&.
1039 .IP o 
1040 The \fB--archive\fP (\fB-a\fP) option\&'s behavior does not imply \fB--recursive\fP
1041 (\fB-r\fP), so specify it explicitly, if you want it\&.
1042 .RE 
1043 .IP 
1044 The file names that are read from the FILE are all relative to the
1045 source dir -- any leading slashes are removed and no "\&.\&." references are
1046 allowed to go higher than the source dir\&.  For example, take this
1047 command:
1048 .IP 
1049 .RS 
1050 \f(CW   rsync -a --files-from=/tmp/foo /usr remote:/backup\fP
1051 .RE 
1052 .IP 
1053 If /tmp/foo contains the string "bin" (or even "/bin"), the /usr/bin
1054 directory will be created as /backup/bin on the remote host\&.  If it
1055 contains "bin/" (note the trailing slash), the immediate contents of
1056 the directory would also be sent (without needing to be explicitly
1057 mentioned in the file -- this began in version 2\&.6\&.4)\&.  In both cases,
1058 if the \fB-r\fP option was enabled, that dir\&'s entire hierarchy would
1059 also be transferred (keep in mind that \fB-r\fP needs to be specified
1060 explicitly with \fB--files-from\fP, since it is not implied by \fB-a\fP)\&.
1061 Also note
1062 that the effect of the (enabled by default) \fB--relative\fP option is to
1063 duplicate only the path info that is read from the file -- it does not
1064 force the duplication of the source-spec path (/usr in this case)\&.
1065 .IP 
1066 In addition, the \fB--files-from\fP file can be read from the remote host
1067 instead of the local host if you specify a "host:" in front of the file
1068 (the host must match one end of the transfer)\&.  As a short-cut, you can
1069 specify just a prefix of ":" to mean "use the remote end of the
1070 transfer"\&.  For example:
1071 .IP 
1072 .RS 
1073 \f(CW   rsync -a --files-from=:/path/file-list src:/ /tmp/copy\fP
1074 .RE 
1075 .IP 
1076 This would copy all the files specified in the /path/file-list file that
1077 was located on the remote "src" host\&.
1078 .IP 
1079 .IP "\fB-0, --from0\fP" 
1080 This tells rsync that the rules/filenames it reads from a
1081 file are terminated by a null (\&'\e0\&') character, not a NL, CR, or CR+LF\&.
1082 This affects \fB--exclude-from\fP, \fB--include-from\fP, \fB--files-from\fP, and any
1083 merged files specified in a \fB--filter\fP rule\&.
1084 It does not affect \fB--cvs-exclude\fP (since all names read from a \&.cvsignore
1085 file are split on whitespace)\&.
1086 .IP 
1087 .IP "\fB-T, --temp-dir=DIR\fP" 
1088 This option instructs rsync to use DIR as a
1089 scratch directory when creating temporary copies of the files
1090 transferred on the receiving side\&.  The default behavior is to create
1091 the temporary files in the receiving directory\&.
1092 .IP 
1093 .IP "\fB-y, --fuzzy\fP" 
1094 This option tells rsync that it should look for a
1095 basis file for any destination file that is missing\&.  The current algorithm
1096 looks in the same directory as the destination file for either a file that
1097 has an identical size and modified-time, or a similarly-named file\&.  If
1098 found, rsync uses the fuzzy basis file to try to speed up the transfer\&.
1099 .IP 
1100 Note that the use of the \fB--delete\fP option might get rid of any potential
1101 fuzzy-match files, so either use \fB--delete-after\fP or specify some
1102 filename exclusions if you need to prevent this\&.
1103 .IP 
1104 .IP "\fB--compare-dest=DIR\fP" 
1105 This option instructs rsync to use \fIDIR\fP on
1106 the destination machine as an additional hierarchy to compare destination
1107 files against doing transfers (if the files are missing in the destination
1108 directory)\&.  If a file is found in \fIDIR\fP that is identical to the
1109 sender\&'s file, the file will NOT be transferred to the destination
1110 directory\&.  This is useful for creating a sparse backup of just files that
1111 have changed from an earlier backup\&.
1112 .IP 
1113 Beginning in version 2\&.6\&.4, multiple \fB--compare-dest\fP directories may be
1114 provided, which will cause rsync to search the list in the order specified
1115 for an exact match\&.
1116 If a match is found that differs only in attributes, a local copy is made
1117 and the attributes updated\&.
1118 If a match is not found, a basis file from one of the \fIDIR\fPs will be
1119 selected to try to speed up the transfer\&.
1120 .IP 
1121 If \fIDIR\fP is a relative path, it is relative to the destination directory\&.
1122 See also \fB--copy-dest\fP and \fB--link-dest\fP\&.
1123 .IP 
1124 .IP "\fB--copy-dest=DIR\fP" 
1125 This option behaves like \fB--compare-dest\fP, but
1126 rsync will also copy unchanged files found in \fIDIR\fP to the destination
1127 directory using a local copy\&.
1128 This is useful for doing transfers to a new destination while leaving
1129 existing files intact, and then doing a flash-cutover when all files have
1130 been successfully transferred\&.
1131 .IP 
1132 Multiple \fB--copy-dest\fP directories may be provided, which will cause
1133 rsync to search the list in the order specified for an unchanged file\&.
1134 If a match is not found, a basis file from one of the \fIDIR\fPs will be
1135 selected to try to speed up the transfer\&.
1136 .IP 
1137 If \fIDIR\fP is a relative path, it is relative to the destination directory\&.
1138 See also \fB--compare-dest\fP and \fB--link-dest\fP\&.
1139 .IP 
1140 .IP "\fB--link-dest=DIR\fP" 
1141 This option behaves like \fB--copy-dest\fP, but
1142 unchanged files are hard linked from \fIDIR\fP to the destination directory\&.
1143 The files must be identical in all preserved attributes (e\&.g\&. permissions,
1144 possibly ownership) in order for the files to be linked together\&.
1145 An example:
1146 .IP 
1147 .RS 
1148 \f(CW  rsync -av --link-dest=$PWD/prior_dir host:src_dir/ new_dir/\fP
1149 .RE 
1150 .IP 
1151 Beginning in version 2\&.6\&.4, multiple \fB--link-dest\fP directories may be
1152 provided, which will cause rsync to search the list in the order specified
1153 for an exact match\&.
1154 If a match is found that differs only in attributes, a local copy is made
1155 and the attributes updated\&.
1156 If a match is not found, a basis file from one of the \fIDIR\fPs will be
1157 selected to try to speed up the transfer\&.
1158 .IP 
1159 If \fIDIR\fP is a relative path, it is relative to the destination directory\&.
1160 See also \fB--compare-dest\fP and \fB--copy-dest\fP\&.
1161 .IP 
1162 Note that rsync versions prior to 2\&.6\&.1 had a bug that could prevent
1163 \fB--link-dest\fP from working properly for a non-root user when \fB-o\fP was specified
1164 (or implied by \fB-a\fP)\&.  You can work-around this bug by avoiding the \fB-o\fP option
1165 when sending to an old rsync\&.
1166 .IP 
1167 .IP "\fB-z, --compress\fP" 
1168 With this option, rsync compresses the file data
1169 as it is sent to the destination machine, which reduces the amount of data
1170 being transmitted -- something that is useful over a slow connection\&.
1171 .IP 
1172 Note this this option typically achieves better compression ratios that can
1173 be achieved by using a compressing remote shell or a compressing transport
1174 because it takes advantage of the implicit information in the matching data
1175 blocks that are not explicitly sent over the connection\&.
1176 .IP 
1177 .IP "\fB--numeric-ids\fP" 
1178 With this option rsync will transfer numeric group
1179 and user IDs rather than using user and group names and mapping them
1180 at both ends\&.
1181 .IP 
1182 By default rsync will use the username and groupname to determine
1183 what ownership to give files\&. The special uid 0 and the special group
1184 0 are never mapped via user/group names even if the \fB--numeric-ids\fP
1185 option is not specified\&.
1186 .IP 
1187 If a user or group has no name on the source system or it has no match
1188 on the destination system, then the numeric ID
1189 from the source system is used instead\&.  See also the comments on the
1190 "use chroot" setting in the rsyncd\&.conf manpage for information on how
1191 the chroot setting affects rsync\&'s ability to look up the names of the
1192 users and groups and what you can do about it\&.
1193 .IP 
1194 .IP "\fB--timeout=TIMEOUT\fP" 
1195 This option allows you to set a maximum I/O
1196 timeout in seconds\&. If no data is transferred for the specified time
1197 then rsync will exit\&. The default is 0, which means no timeout\&.
1198 .IP 
1199 .IP "\fB--address\fP" 
1200 By default rsync will bind to the wildcard address when
1201 connecting to an rsync daemon\&.  The \fB--address\fP option allows you to
1202 specify a specific IP address (or hostname) to bind to\&.  See also this
1203 option in the \fB--daemon\fP mode section\&.
1204 .IP 
1205 .IP "\fB--port=PORT\fP" 
1206 This specifies an alternate TCP port number to use
1207 rather than the default of 873\&.  This is only needed if you are using the
1208 double-colon (::) syntax to connect with an rsync daemon (since the URL
1209 syntax has a way to specify the port as a part of the URL)\&.  See also this
1210 option in the \fB--daemon\fP mode section\&.
1211 .IP 
1212 .IP "\fB--blocking-io\fP" 
1213 This tells rsync to use blocking I/O when launching
1214 a remote shell transport\&.  If the remote shell is either rsh or remsh,
1215 rsync defaults to using
1216 blocking I/O, otherwise it defaults to using non-blocking I/O\&.  (Note that
1217 ssh prefers non-blocking I/O\&.)
1218 .IP 
1219 .IP "\fB--no-blocking-io\fP" 
1220 Turn off \fB--blocking-io\fP, for use when it is the
1221 default\&.
1222 .IP 
1223 .IP "\fB-i, --itemize-changes\fP" 
1224 Requests a simple itemized list of the
1225 changes that are being made to each file, including attribute changes\&.
1226 This is exactly the same as specifying \fB--log-format=\&'%i %n%L\&'\fP\&.
1227 .IP 
1228 The "%i" escape has a cryptic output that is 9 letters long\&.  The general
1229 format is like the string \fBUXcstpoga\fP), where \fBU\fP is replaced by the
1230 kind of update being done, \fBX\fP is replaced by the file-type, and the
1231 other letters represent attributes that may be output if they are being
1232 modified\&.
1233 .IP 
1234 The update types that replace the \fBU\fP are as follows:
1235 .IP 
1236 .RS 
1237 .IP o 
1238 A \fB<\fP means that a file is being transferred to the remote host
1239 (sent)\&.
1240 .IP o 
1241 A \fB>\fP means that a file is being transferred to the local host
1242 (received)\&.
1243 .IP o 
1244 A \fBc\fP means that a local change/creation is occurring for the item
1245 (such as the creation of a directory or the changing of a symlink, etc\&.)\&.
1246 .IP o 
1247 A \fBh\fP means that the item is a hard-link to another item (requires
1248 \fB--hard-links\fP)\&.
1249 .IP o 
1250 A \fB\&.\fP means that the item is not being updated (though it might
1251 have attributes that are being modified)\&.
1252 .RE 
1253 .IP 
1254 The file-types that replace the \fBX\fP are: \fBf\fP for a file, a \fBd\fP for a
1255 directory, an \fBL\fP for a symlink, and a \fBD\fP for a device\&.
1256 .IP 
1257 The other letters in the string above are the actual letters that
1258 will be output if the associated attribute for the item is being updated or
1259 a "\&." for no change\&.  Three exceptions to this are: (1) a newly created
1260 item replaces each letter with a "+", (2) an identical item replaces the
1261 dots with spaces, and (3) an unknown attribute replaces each letter with
1262 a "?" (this can happen when talking to an older rsync)\&.
1263 .IP 
1264 The attribute that is associated with each letter is as follows:
1265 .IP 
1266 .RS 
1267 .IP o 
1268 A \fBc\fP means the checksum of the file is different and will be
1269 updated by the file transfer (requires \fB--checksum\fP)\&.
1270 .IP o 
1271 A \fBs\fP means the size of the file is different and will be updated
1272 by the file transfer\&.
1273 .IP o 
1274 A \fBt\fP means the modification time is different and is being updated
1275 to the sender\&'s value (requires \fB--times\fP)\&.  An alternate value of \fBT\fP
1276 means that the time will be set to the transfer time, which happens
1277 anytime a symlink is transferred, or when a file or device is transferred
1278 without \fB--times\fP\&.
1279 .IP o 
1280 A \fBp\fP means the permissions are different and are being updated to
1281 the sender\&'s value (requires \fB--perms\fP)\&.
1282 .IP o 
1283 An \fBo\fP means the owner is different and is being updated to the
1284 sender\&'s value (requires \fB--owner\fP and root privileges)\&.
1285 .IP o 
1286 A \fBg\fP means the group is different and is being updated to the
1287 sender\&'s value (requires \fB--group\fP and the authority to set the group)\&.
1288 .IP o 
1289 The \fBa\fP is reserved for a future enhanced version that supports
1290 extended file attributes, such as ACLs\&.
1291 .RE 
1292 .IP 
1293 One other output is possible:  when deleting files, the "%i" will output
1294 the string "*deleting" for each item that is being removed (assuming that
1295 you are talking to a recent enough rsync that it logs deletions instead of
1296 outputting them as a verbose message)\&.
1297 .IP 
1298 .IP "\fB--log-format=FORMAT\fP" 
1299 This allows you to specify exactly what the
1300 rsync client outputs to the user on a per-file basis\&.  The format is a text
1301 string containing embedded single-character escape sequences prefixed with
1302 a percent (%) character\&.  For a list of the possible escape characters, see
1303 the "log format" setting in the rsyncd\&.conf manpage\&.  (Note that this
1304 option does not affect what a daemon logs to its logfile\&.)
1305 .IP 
1306 Specifying this option will mention each file, dir, etc\&. that gets updated
1307 in a significant way (a transferred file, a recreated symlink/device, or a
1308 touched directory) unless the itemized-changes escape (%i) is included in
1309 the string, in which case the logging of names increases to mention any
1310 item that is changed in any way (as long as the receiving side is at least
1311 2\&.6\&.4)\&.  See the \fB--itemized-changes\fP option for a description of the
1312 output of "%i"\&.
1313 .IP 
1314 The \fB--verbose\fP option implies a format of "%n%L", but you can use
1315 \fB--log-format\fP without bv(--verbose) if you like, or you can override
1316 the format of its per-file output using this option\&.
1317 .IP 
1318 Rsync will output the log-format string prior to a file\&'s transfer unless
1319 one of the transfer-statistic escapes is requested, in which case the
1320 logging is done at the end of the file\&'s transfer\&.  When this late logging
1321 is in effect and \fB--progress\fP is also specified, rsync will also output
1322 the name of the file being transferred prior to its progress information
1323 (followed, of course, by the log-format output)\&.
1324 .IP 
1325 .IP "\fB--stats\fP" 
1326 This tells rsync to print a verbose set of statistics
1327 on the file transfer, allowing you to tell how effective the rsync
1328 algorithm is for your data\&.
1329 .IP 
1330 .IP "\fB--partial\fP" 
1331 By default, rsync will delete any partially
1332 transferred file if the transfer is interrupted\&. In some circumstances
1333 it is more desirable to keep partially transferred files\&. Using the
1334 \fB--partial\fP option tells rsync to keep the partial file which should
1335 make a subsequent transfer of the rest of the file much faster\&.
1336 .IP 
1337 .IP "\fB--partial-dir=DIR\fP" 
1338 A better way to keep partial files than the
1339 \fB--partial\fP option is to specify a \fIDIR\fP that will be used to hold the
1340 partial data (instead of writing it out to the destination file)\&.
1341 On the next transfer, rsync will use a file found in this
1342 dir as data to speed up the resumption of the transfer and then deletes it
1343 after it has served its purpose\&.
1344 Note that if \fB--whole-file\fP is specified (or implied), any partial-dir
1345 file that is found for a file that is being updated will simply be removed
1346 (since
1347 rsync is sending files without using the incremental rsync algorithm)\&.
1348 .IP 
1349 Rsync will create the \fIDIR\fP if it is missing (just the last dir -- not
1350 the whole path)\&.  This makes it easy to use a relative path (such as
1351 "\fB--partial-dir=\&.rsync-partial\fP") to have rsync create the
1352 partial-directory in the destination file\&'s directory when needed, and then
1353 remove it again when the partial file is deleted\&.
1354 .IP 
1355 If the partial-dir value is not an absolute path, rsync will also add a directory
1356 \fB--exclude\fP of this value at the end of all your existing excludes\&.  This
1357 will prevent partial-dir files from being transferred and also prevent the
1358 untimely deletion of partial-dir items on the receiving side\&.  An example:
1359 the above \fB--partial-dir\fP option would add an "\fB--exclude=\&.rsync-partial/\fP"
1360 rule at the end of any other filter rules\&.  Note that if you are
1361 supplying your own filter rules, you may need to manually insert a
1362 rule for this directory exclusion somewhere higher up in the list so that
1363 it has a high enough priority to be effective (e\&.g\&., if your rules specify
1364 a trailing \fB--exclude=\&'*\&'\fP rule, the auto-added rule would never be
1365 reached)\&.
1366 .IP 
1367 IMPORTANT: the \fB--partial-dir\fP should not be writable by other users or it
1368 is a security risk\&.  E\&.g\&. AVOID "/tmp"\&.
1369 .IP 
1370 You can also set the partial-dir value the RSYNC_PARTIAL_DIR environment
1371 variable\&.  Setting this in the environment does not force \fB--partial\fP to be
1372 enabled, but rather it effects where partial files go when \fB--partial\fP is
1373 specified\&.  For instance, instead of using \fB--partial-dir=\&.rsync-tmp\fP
1374 along with \fB--progress\fP, you could set RSYNC_PARTIAL_DIR=\&.rsync-tmp in your
1375 environment and then just use the \fB-P\fP option to turn on the use of the
1376 \&.rsync-tmp dir for partial transfers\&.  The only time that the \fB--partial\fP
1377 option does not look for this environment value is (1) when \fB--inplace\fP was
1378 specified (since \fB--inplace\fP conflicts with \fB--partial-dir\fP), or (2) when
1379 \fB--delay-updates\fP was specified (see below)\&.
1380 .IP 
1381 For the purposes of the daemon-config\&'s "refuse options" setting,
1382 \fB--partial-dir\fP does \fInot\fP imply \fB--partial\fP\&.  This is so that a
1383 refusal of the \fB--partial\fP option can be used to disallow the overwriting
1384 of destination files with a partial transfer, while still allowing the
1385 safer idiom provided by \fB--partial-dir\fP\&.
1386 .IP 
1387 .IP "\fB--delay-updates\fP" 
1388 This option puts the temporary file from each
1389 updated file into a holding directory until the end of the
1390 transfer, at which time all the files are renamed into place in rapid
1391 succession\&.  This attempts to make the updating of the files a little more
1392 atomic\&.  By default the files are placed into a directory named "\&.~tmp~" in
1393 each file\&'s destination directory, but you can override this by specifying
1394 the \fB--partial-dir\fP option\&.  (Note that RSYNC_PARTIAL_DIR has no effect
1395 on this value, nor is \fB--partial-dir\fP considered to be implied for the
1396 purposes of the daemon-config\&'s "refuse options" setting\&.)
1397 Conflicts with \fB--inplace\fP\&.
1398 .IP 
1399 This option uses more memory on the receiving side (one bit per file
1400 transferred) and also requires enough free disk space on the receiving
1401 side to hold an additional copy of all the updated files\&.  Note also that
1402 you should not use an absolute path to \fB--partial-dir\fP unless there is no
1403 chance of any of the files in the transfer having the same name (since all
1404 the updated files will be put into a single directory if the path is
1405 absolute)\&.
1406 .IP 
1407 See also the "atomic-rsync" perl script in the "support" subdir for an
1408 update algorithm that is even more atomic (it uses \fB--link-dest\fP and a
1409 parallel hierarchy of files)\&.
1410 .IP 
1411 .IP "\fB--progress\fP" 
1412 This option tells rsync to print information
1413 showing the progress of the transfer\&. This gives a bored user
1414 something to watch\&.
1415 Implies \fB--verbose\fP if it wasn\&'t already specified\&.
1416 .IP 
1417 When the file is transferring, the data looks like this:
1418 .IP 
1419
1420 .nf 
1421  
1422       782448  63%  110\&.64kB/s    0:00:04
1423 .fi 
1424  
1425
1426 .IP 
1427 This tells you the current file size, the percentage of the transfer that
1428 is complete, the current calculated file-completion rate (including both
1429 data over the wire and data being matched locally), and the estimated time
1430 remaining in this transfer\&.
1431 .IP 
1432 After a file is complete, the data looks like this:
1433 .IP 
1434
1435 .nf 
1436  
1437      1238099 100%  146\&.38kB/s    0:00:08  (5, 57\&.1% of 396)
1438 .fi 
1439  
1440
1441 .IP 
1442 This tells you the final file size, that it\&'s 100% complete, the final
1443 transfer rate for the file, the amount of elapsed time it took to transfer
1444 the file, and the addition of a total-transfer summary in parentheses\&.
1445 These additional numbers tell you how many files have been updated, and
1446 what percent of the total number of files has been scanned\&.
1447 .IP 
1448 .IP "\fB-P\fP" 
1449 The \fB-P\fP option is equivalent to \fB--partial\fP \fB--progress\fP\&.  Its
1450 purpose is to make it much easier to specify these two options for a long
1451 transfer that may be interrupted\&.
1452 .IP 
1453 .IP "\fB--password-file\fP" 
1454 This option allows you to provide a password
1455 in a file for accessing a remote rsync daemon\&. Note that this option
1456 is only useful when accessing an rsync daemon using the built in
1457 transport, not when using a remote shell as the transport\&. The file
1458 must not be world readable\&. It should contain just the password as a
1459 single line\&.
1460 .IP 
1461 .IP "\fB--list-only\fP" 
1462 This option will cause the source files to be listed
1463 instead of transferred\&.  This option is inferred if there is no destination
1464 specified, so you don\&'t usually need to use it explicitly\&.  However, it can
1465 come in handy for a user that wants to avoid the "\fB-r --exclude=\&'/*/*\&'\fP"
1466 options that rsync might use as a compatibility kluge when generating a
1467 non-recursive listing, or to list the files that are involved in a local
1468 copy (since the destination path is not optional for a local copy, you
1469 must specify this option explicitly and still include a destination)\&.
1470 .IP 
1471 .IP "\fB--bwlimit=KBPS\fP" 
1472 This option allows you to specify a maximum
1473 transfer rate in kilobytes per second\&. This option is most effective when
1474 using rsync with large files (several megabytes and up)\&. Due to the nature
1475 of rsync transfers, blocks of data are sent, then if rsync determines the
1476 transfer was too fast, it will wait before sending the next data block\&. The
1477 result is an average transfer rate equaling the specified limit\&. A value
1478 of zero specifies no limit\&.
1479 .IP 
1480 .IP "\fB--write-batch=FILE\fP" 
1481 Record a file that can later be applied to
1482 another identical destination with \fB--read-batch\fP\&. See the "BATCH MODE"
1483 section for details, and also the \fB--only-write-batch\fP option\&.
1484 .IP 
1485 .IP "\fB--only-write-batch=FILE\fP" 
1486 Works like \fB--write-batch\fP, except that
1487 no updates are made on the destination system when creating the batch\&.
1488 This lets you transport the changes to the destination system via some
1489 other means and then apply the changes via \fB--read-batch\fP\&.
1490 .IP 
1491 Note that you can feel free to write the batch directly to some portable
1492 media: if this media fills to capacity before the end of the transfer, you
1493 can just apply that partial transfer to the destination and repeat the
1494 whole process to get the rest of the changes (as long as you don\&'t mind a
1495 partially updated destination system while the multi-update cycle is
1496 happening)\&.
1497 .IP 
1498 Also note that you only save bandwidth when pushing changes to a remote
1499 system because this allows the batched data to be diverted from the sender
1500 into the batch file without having to flow over the wire to the receiver
1501 (when pulling, the sender is remote, and thus can\&'t write the batch)\&.
1502 .IP 
1503 .IP "\fB--read-batch=FILE\fP" 
1504 Apply all of the changes stored in FILE, a
1505 file previously generated by \fB--write-batch\fP\&.
1506 If \fIFILE\fP is "-" the batch data will be read from standard input\&.
1507 See the "BATCH MODE" section for details\&.
1508 .IP 
1509 .IP "\fB--protocol=NUM\fP" 
1510 Force an older protocol version to be used\&.  This
1511 is useful for creating a batch file that is compatible with an older
1512 version of rsync\&.  For instance, if rsync 2\&.6\&.4 is being used with the
1513 \fB--write-batch\fP option, but rsync 2\&.6\&.3 is what will be used to run the
1514 \fB--read-batch\fP option, you should use "--protocol=28" when creating the
1515 batch file to force the older protocol version to be used in the batch
1516 file (assuming you can\&'t upgrade the rsync on the reading system)\&.
1517 .IP 
1518 .IP "\fB-4, --ipv4\fP or \fB-6, --ipv6\fP" 
1519 Tells rsync to prefer IPv4/IPv6
1520 when creating sockets\&.  This only affects sockets that rsync has direct
1521 control over, such as the outgoing socket when directly contacting an
1522 rsync daemon\&.  See also these options in the \fB--daemon\fP mode section\&.
1523 .IP 
1524 .IP "\fB--checksum-seed=NUM\fP" 
1525 Set the MD4 checksum seed to the integer
1526 NUM\&.  This 4 byte checksum seed is included in each block and file
1527 MD4 checksum calculation\&.  By default the checksum seed is generated
1528 by the server and defaults to the current time()\&.  This option
1529 is used to set a specific checksum seed, which is useful for
1530 applications that want repeatable block and file checksums, or
1531 in the case where the user wants a more random checksum seed\&.
1532 Note that setting NUM to 0 causes rsync to use the default of time()
1533 for checksum seed\&.
1534 .PP 
1535 .SH "DAEMON OPTIONS" 
1536 .PP 
1537 The options allowed when starting an rsync daemon are as follows:
1538 .PP 
1539 .IP "\fB--daemon\fP" 
1540 This tells rsync that it is to run as a daemon\&.  The
1541 daemon you start running may be accessed using an rsync client using
1542 the \fBhost::module\fP or \fBrsync://host/module/\fP syntax\&.
1543 .IP 
1544 If standard input is a socket then rsync will assume that it is being
1545 run via inetd, otherwise it will detach from the current terminal and
1546 become a background daemon\&.  The daemon will read the config file
1547 (rsyncd\&.conf) on each connect made by a client and respond to
1548 requests accordingly\&.  See the rsyncd\&.conf(5) man page for more
1549 details\&.
1550 .IP 
1551 .IP "\fB--address\fP" 
1552 By default rsync will bind to the wildcard address when
1553 run as a daemon with the \fB--daemon\fP option\&.  The \fB--address\fP option
1554 allows you to specify a specific IP address (or hostname) to bind to\&.  This
1555 makes virtual hosting possible in conjunction with the \fB--config\fP option\&.
1556 See also the "address" global option in the rsyncd\&.conf manpage\&.
1557 .IP 
1558 .IP "\fB--bwlimit=KBPS\fP" 
1559 This option allows you to specify a maximum
1560 transfer rate in kilobytes per second for the data the daemon sends\&.
1561 The client can still specify a smaller \fB--bwlimit\fP value, but their
1562 requested value will be rounded down if they try to exceed it\&.  See the
1563 client version of this option (above) for some extra details\&.
1564 .IP 
1565 .IP "\fB--config=FILE\fP" 
1566 This specifies an alternate config file than
1567 the default\&.  This is only relevant when \fB--daemon\fP is specified\&.
1568 The default is /etc/rsyncd\&.conf unless the daemon is running over
1569 a remote shell program and the remote user is not root; in that case
1570 the default is rsyncd\&.conf in the current directory (typically $HOME)\&.
1571 .IP 
1572 .IP "\fB--no-detach\fP" 
1573 When running as a daemon, this option instructs
1574 rsync to not detach itself and become a background process\&.  This
1575 option is required when running as a service on Cygwin, and may also
1576 be useful when rsync is supervised by a program such as
1577 \fBdaemontools\fP or AIX\&'s \fBSystem Resource Controller\fP\&.
1578 \fB--no-detach\fP is also recommended when rsync is run under a
1579 debugger\&.  This option has no effect if rsync is run from inetd or
1580 sshd\&.
1581 .IP 
1582 .IP "\fB--port=PORT\fP" 
1583 This specifies an alternate TCP port number for the
1584 daemon to listen on rather than the default of 873\&.  See also the "port"
1585 global option in the rsyncd\&.conf manpage\&.
1586 .IP 
1587 .IP "\fB-v, --verbose\fP" 
1588 This option increases the amount of information the
1589 daemon logs during its startup phase\&.  After the client connects, the
1590 daemon\&'s verbosity level will be controlled by the options that the client
1591 used and the "max verbosity" setting in the module\&'s config section\&.
1592 .IP 
1593 .IP "\fB-4, --ipv4\fP or \fB-6, --ipv6\fP" 
1594 Tells rsync to prefer IPv4/IPv6
1595 when creating the incoming sockets that the rsync daemon will use to
1596 listen for connections\&.  One of these options may be required in older
1597 versions of Linux to work around an IPv6 bug in the kernel (if you see
1598 an "address already in use" error when nothing else is using the port,
1599 try specifying \fB--ipv6\fP or \fB--ipv4\fP when starting the daemon)\&.
1600 .IP 
1601 .IP "\fB-h, --help\fP" 
1602 When specified after \fB--daemon\fP, print a short help
1603 page describing the options available for starting an rsync daemon\&.
1604 .PP 
1605 .SH "FILTER RULES" 
1606 .PP 
1607 The filter rules allow for flexible selection of which files to transfer
1608 (include) and which files to skip (exclude)\&.  The rules either directly
1609 specify include/exclude patterns or they specify a way to acquire more
1610 include/exclude patterns (e\&.g\&. to read them from a file)\&.
1611 .PP 
1612 As the list of files/directories to transfer is built, rsync checks each
1613 name to be transferred against the list of include/exclude patterns in
1614 turn, and the first matching pattern is acted on:  if it is an exclude
1615 pattern, then that file is skipped; if it is an include pattern then that
1616 filename is not skipped; if no matching pattern is found, then the
1617 filename is not skipped\&.
1618 .PP 
1619 Rsync builds an ordered list of filter rules as specified on the
1620 command-line\&.  Filter rules have the following syntax:
1621 .PP 
1622 .RS 
1623 \f(CWRULE [PATTERN_OR_FILENAME]\fP
1624 .br 
1625 \f(CWRULE,MODIFIERS [PATTERN_OR_FILENAME]\fP
1626 .br 
1627 .RE 
1628 .PP 
1629 You have your choice of using either short or long RULE names, as described
1630 below\&.  If you use a short-named rule, the \&',\&' separating the RULE from the
1631 MODIFIERS is optional\&.  The PATTERN or FILENAME that follows (when present)
1632 must come after either a single space or an underscore (_)\&.
1633 Here are the available rule prefixes:
1634 .PP 
1635 .RS 
1636 \fBexclude, -\fP specifies an exclude pattern\&. 
1637 .br 
1638 \fBinclude, +\fP specifies an include pattern\&. 
1639 .br 
1640 \fBmerge, \&.\fP specifies a merge-file to read for more rules\&. 
1641 .br 
1642 \fBdir-merge, :\fP specifies a per-directory merge-file\&. 
1643 .br 
1644 \fBhide, H\fP specifies a pattern for hiding files from the transfer\&. 
1645 .br 
1646 \fBshow, S\fP files that match the pattern are not hidden\&. 
1647 .br 
1648 \fBprotect, P\fP specifies a pattern for protecting files from deletion\&. 
1649 .br 
1650 \fBrisk, R\fP files that match the pattern are not protected\&. 
1651 .br 
1652 \fBclear, !\fP clears the current include/exclude list (takes no arg) 
1653 .br 
1654 .RE 
1655 .PP 
1656 When rules are being read from a file, empty lines are ignored, as are
1657 comment lines that start with a "#"\&.
1658 .PP 
1659 Note that the \fB--include\fP/\fB--exclude\fP command-line options do not allow the
1660 full range of rule parsing as described above -- they only allow the
1661 specification of include/exclude patterns plus a "!" token to clear the
1662 list (and the normal comment parsing when rules are read from a file)\&.
1663 If a pattern
1664 does not begin with "- " (dash, space) or "+ " (plus, space), then the
1665 rule will be interpreted as if "+ " (for an include option) or "- " (for
1666 an exclude option) were prefixed to the string\&.  A \fB--filter\fP option, on
1667 the other hand, must always contain either a short or long rule name at the
1668 start of the rule\&.
1669 .PP 
1670 Note also that the \fB--filter\fP, \fB--include\fP, and \fB--exclude\fP options take one
1671 rule/pattern each\&. To add multiple ones, you can repeat the options on
1672 the command-line, use the merge-file syntax of the \fB--filter\fP option, or
1673 the \fB--include-from\fP/\fB--exclude-from\fP options\&.
1674 .PP 
1675 .SH "INCLUDE/EXCLUDE PATTERN RULES" 
1676 .PP 
1677 You can include and exclude files by specifying patterns using the "+",
1678 "-", etc\&. filter rules (as introduced in the FILTER RULES section above)\&.
1679 The include/exclude rules each specify a pattern that is matched against
1680 the names of the files that are going to be transferred\&.  These patterns
1681 can take several forms:
1682 .PP 
1683 .IP o 
1684 if the pattern starts with a / then it is anchored to a
1685 particular spot in the hierarchy of files, otherwise it is matched
1686 against the end of the pathname\&.  This is similar to a leading ^ in
1687 regular expressions\&.
1688 Thus "/foo" would match a file called "foo" at either the "root of the
1689 transfer" (for a global rule) or in the merge-file\&'s directory (for a
1690 per-directory rule)\&.
1691 An unqualified "foo" would match any file or directory named "foo"
1692 anywhere in the tree because the algorithm is applied recursively from
1693 the
1694 top down; it behaves as if each path component gets a turn at being the
1695 end of the file name\&.  Even the unanchored "sub/foo" would match at
1696 any point in the hierarchy where a "foo" was found within a directory
1697 named "sub"\&.  See the section on ANCHORING INCLUDE/EXCLUDE PATTERNS for
1698 a full discussion of how to specify a pattern that matches at the root
1699 of the transfer\&.
1700 .IP o 
1701 if the pattern ends with a / then it will only match a
1702 directory, not a file, link, or device\&.
1703 .IP o 
1704 if the pattern contains a wildcard character from the set
1705 *?[ then expression matching is applied using the shell filename
1706 matching rules\&. Otherwise a simple string match is used\&.
1707 .IP o 
1708 the double asterisk pattern "**" will match slashes while a
1709 single asterisk pattern "*" will stop at slashes\&.
1710 .IP o 
1711 if the pattern contains a / (not counting a trailing /) or a "**"
1712 then it is matched against the full pathname, including any leading
1713 directories\&. If the pattern doesn\&'t contain a / or a "**", then it is
1714 matched only against the final component of the filename\&.
1715 (Remember that the algorithm is applied recursively so "full filename"
1716 can actually be any portion of a path from the starting directory on
1717 down\&.)
1718 .PP 
1719 Note that, when using the \fB--recursive\fP (\fB-r\fP) option (which is implied by
1720 \fB-a\fP), every subcomponent of every path is visited from the top down, so
1721 include/exclude patterns get applied recursively to each subcomponent\&'s
1722 full name (e\&.g\&. to include "/foo/bar/baz" the subcomponents "/foo" and
1723 "/foo/bar" must not be excluded)\&.
1724 The exclude patterns actually short-circuit the directory traversal stage
1725 when rsync finds the files to send\&.  If a pattern excludes a particular
1726 parent directory, it can render a deeper include pattern ineffectual
1727 because rsync did not descend through that excluded section of the
1728 hierarchy\&.  This is particularly important when using a trailing \&'*\&' rule\&.
1729 For instance, this won\&'t work:
1730 .PP 
1731 .RS 
1732 \f(CW+ /some/path/this-file-will-not-be-found\fP
1733 .br 
1734 \f(CW+ /file-is-included\fP
1735 .br 
1736 \f(CW- *\fP
1737 .br 
1738 .RE 
1739 .PP 
1740 This fails because the parent directory "some" is excluded by the \&'*\&'
1741 rule, so rsync never visits any of the files in the "some" or "some/path"
1742 directories\&.  One solution is to ask for all directories in the hierarchy
1743 to be included by using a single rule: "+ */" (put it somewhere before the
1744 "- *" rule)\&.  Another solution is to add specific include rules for all
1745 the parent dirs that need to be visited\&.  For instance, this set of rules
1746 works fine:
1747 .PP 
1748 .RS 
1749 \f(CW+ /some/\fP
1750 .br 
1751 \f(CW+ /some/path/\fP
1752 .br 
1753 \f(CW+ /some/path/this-file-is-found\fP
1754 .br 
1755 \f(CW+ /file-also-included\fP
1756 .br 
1757 \f(CW- *\fP
1758 .br 
1759 .RE 
1760 .PP 
1761 Here are some examples of exclude/include matching:
1762 .PP 
1763 .IP o 
1764 "- *\&.o" would exclude all filenames matching *\&.o
1765 .IP o 
1766 "- /foo" would exclude a file called foo in the transfer-root directory
1767 .IP o 
1768 "- foo/" would exclude any directory called foo
1769 .IP o 
1770 "- /foo/*/bar" would exclude any file called bar two
1771 levels below a directory called foo in the transfer-root directory
1772 .IP o 
1773 "- /foo/**/bar" would exclude any file called bar two
1774 or more levels below a directory called foo in the transfer-root directory
1775 .IP o 
1776 The combination of "+ */", "+ *\&.c", and "- *" would include all
1777 directories and C source files but nothing else\&.
1778 .IP o 
1779 The combination of "+ foo/", "+ foo/bar\&.c", and "- *" would include
1780 only the foo directory and foo/bar\&.c (the foo directory must be
1781 explicitly included or it would be excluded by the "*")
1782 .PP 
1783 .SH "MERGE-FILE FILTER RULES" 
1784 .PP 
1785 You can merge whole files into your filter rules by specifying either a
1786 merge (\&.) or a dir-merge (:) filter rule (as introduced in the FILTER RULES
1787 section above)\&.
1788 .PP 
1789 There are two kinds of merged files -- single-instance (\&'\&.\&') and
1790 per-directory (\&':\&')\&.  A single-instance merge file is read one time, and
1791 its rules are incorporated into the filter list in the place of the "\&."
1792 rule\&.  For per-directory merge files, rsync will scan every directory that
1793 it traverses for the named file, merging its contents when the file exists
1794 into the current list of inherited rules\&.  These per-directory rule files
1795 must be created on the sending side because it is the sending side that is
1796 being scanned for the available files to transfer\&.  These rule files may
1797 also need to be transferred to the receiving side if you want them to
1798 affect what files don\&'t get deleted (see PER-DIRECTORY RULES AND DELETE
1799 below)\&.
1800 .PP 
1801 Some examples:
1802 .PP 
1803 .RS 
1804 \f(CWmerge /etc/rsync/default\&.rules\fP
1805 .br 
1806 \f(CW\&. /etc/rsync/default\&.rules\fP
1807 .br 
1808 \f(CWdir-merge \&.per-dir-filter\fP
1809 .br 
1810 \f(CWdir-merge,n- \&.non-inherited-per-dir-excludes\fP
1811 .br 
1812 \f(CW:n- \&.non-inherited-per-dir-excludes\fP
1813 .br 
1814 .RE 
1815 .PP 
1816 The following modifiers are accepted after a merge or dir-merge rule:
1817 .PP 
1818 .IP o 
1819 A \fB-\fP specifies that the file should consist of only exclude
1820 patterns, with no other rule-parsing except for in-file comments\&.
1821 .IP o 
1822 A \fB+\fP specifies that the file should consist of only include
1823 patterns, with no other rule-parsing except for in-file comments\&.
1824 .IP o 
1825 A \fBC\fP is a way to specify that the file should be read in a
1826 CVS-compatible manner\&.  This turns on \&'n\&', \&'w\&', and \&'-\&', but also
1827 allows the list-clearing token (!) to be specified\&.  If no filename is
1828 provided, "\&.cvsignore" is assumed\&.
1829 .IP o 
1830 A \fBe\fP will exclude the merge-file name from the transfer; e\&.g\&.
1831 "dir-merge,e \&.rules" is like "dir-merge \&.rules" and "- \&.rules"\&.
1832 .IP o 
1833 An \fBn\fP specifies that the rules are not inherited by subdirectories\&.
1834 .IP o 
1835 A \fBw\fP specifies that the rules are word-split on whitespace instead
1836 of the normal line-splitting\&.  This also turns off comments\&.  Note: the
1837 space that separates the prefix from the rule is treated specially, so
1838 "- foo + bar" is parsed as two rules (assuming that prefix-parsing wasn\&'t
1839 also disabled)\&.
1840 .IP o 
1841 You may also specify any of the modifiers for the "+" or "-" rules
1842 (below) in order  to have the rules that are read-in from the file
1843 default to having that modifier set\&.  For instance, "merge,-/ \&.excl" would
1844 treat the contents of \&.excl as absolute-path excludes,
1845 while "dir-merge,s \&.filt" and ":sC" would each make all their
1846 per-directory rules apply only on the sending side\&.
1847 .PP 
1848 The following modifiers are accepted after a "+" or "-":
1849 .PP 
1850 .IP o 
1851 A "/" specifies that the include/exclude should be treated as an
1852 absolute path, relative to the root of the filesystem\&.  For example,
1853 "-/ /etc/passwd" would exclude the passwd file any time the transfer
1854 was sending files from the "/etc" directory\&.
1855 .IP o 
1856 A "!" specifies that the include/exclude should take effect if
1857 the pattern fails to match\&.  For instance, "-! */" would exclude all
1858 non-directories\&.
1859 .IP o 
1860 A \fBC\fP is used to indicate that all the global CVS-exclude rules
1861 should be inserted as excludes in place of the "-C"\&.  No arg should
1862 follow\&.
1863 .IP o 
1864 An \fBs\fP is used to indicate that the rule applies to the sending
1865 side\&.  When a rule affects the sending side, it prevents files from
1866 being transferred\&.  The default is for a rule to affect both sides
1867 unless \fB--delete-excluded\fP was specified, in which case default rules
1868 become sender-side only\&.  See also the hide (H) and show (S) rules,
1869 which are an alternate way to specify sending-side includes/excludes\&.
1870 .IP o 
1871 An \fBr\fP is used to indicate that the rule applies to the receiving
1872 side\&.  When a rule affects the receiving side, it prevents files from
1873 being deleted\&.  See the \fBs\fP modifier for more info\&.  See also the
1874 protect (P) and risk (R) rules, which are an alternate way to
1875 specify receiver-side includes/excludes\&.
1876 .PP 
1877 Per-directory rules are inherited in all subdirectories of the directory
1878 where the merge-file was found unless the \&'n\&' modifier was used\&.  Each
1879 subdirectory\&'s rules are prefixed to the inherited per-directory rules
1880 from its parents, which gives the newest rules a higher priority than the
1881 inherited rules\&.  The entire set of dir-merge rules are grouped together in
1882 the spot where the merge-file was specified, so it is possible to override
1883 dir-merge rules via a rule that got specified earlier in the list of global
1884 rules\&.  When the list-clearing rule ("!") is read from a per-directory
1885 file, it only clears the inherited rules for the current merge file\&.
1886 .PP 
1887 Another way to prevent a single rule from a dir-merge file from being inherited is to
1888 anchor it with a leading slash\&.  Anchored rules in a per-directory
1889 merge-file are relative to the merge-file\&'s directory, so a pattern "/foo"
1890 would only match the file "foo" in the directory where the dir-merge filter
1891 file was found\&.
1892 .PP 
1893 Here\&'s an example filter file which you\&'d specify via \fB--filter="\&. file":\fP
1894 .PP 
1895 .RS 
1896 \f(CWmerge /home/user/\&.global-filter\fP
1897 .br 
1898 \f(CW- *\&.gz\fP
1899 .br 
1900 \f(CWdir-merge \&.rules\fP
1901 .br 
1902 \f(CW+ *\&.[ch]\fP
1903 .br 
1904 \f(CW- *\&.o\fP
1905 .br 
1906 .RE 
1907 .PP 
1908 This will merge the contents of the /home/user/\&.global-filter file at the
1909 start of the list and also turns the "\&.rules" filename into a per-directory
1910 filter file\&.  All rules read-in prior to the start of the directory scan
1911 follow the global anchoring rules (i\&.e\&. a leading slash matches at the root
1912 of the transfer)\&.
1913 .PP 
1914 If a per-directory merge-file is specified with a path that is a parent
1915 directory of the first transfer directory, rsync will scan all the parent
1916 dirs from that starting point to the transfer directory for the indicated
1917 per-directory file\&.  For instance, here is a common filter (see \fB-F\fP):
1918 .PP 
1919 .RS 
1920 \f(CW--filter=\&': /\&.rsync-filter\&'\fP
1921 .RE 
1922 .PP 
1923 That rule tells rsync to scan for the file \&.rsync-filter in all
1924 directories from the root down through the parent directory of the
1925 transfer prior to the start of the normal directory scan of the file in
1926 the directories that are sent as a part of the transfer\&.  (Note: for an
1927 rsync daemon, the root is always the same as the module\&'s "path"\&.)
1928 .PP 
1929 Some examples of this pre-scanning for per-directory files:
1930 .PP 
1931 .RS 
1932 \f(CWrsync -avF /src/path/ /dest/dir\fP
1933 .br 
1934 \f(CWrsync -av --filter=\&': \&.\&./\&.\&./\&.rsync-filter\&' /src/path/ /dest/dir\fP
1935 .br 
1936 \f(CWrsync -av --filter=\&': \&.rsync-filter\&' /src/path/ /dest/dir\fP
1937 .br 
1938 .RE 
1939 .PP 
1940 The first two commands above will look for "\&.rsync-filter" in "/" and
1941 "/src" before the normal scan begins looking for the file in "/src/path"
1942 and its subdirectories\&.  The last command avoids the parent-dir scan
1943 and only looks for the "\&.rsync-filter" files in each directory that is
1944 a part of the transfer\&.
1945 .PP 
1946 If you want to include the contents of a "\&.cvsignore" in your patterns,
1947 you should use the rule ":C", which creates a dir-merge of the \&.cvsignore
1948 file, but parsed in a CVS-compatible manner\&.  You can
1949 use this to affect where the \fB--cvs-exclude\fP (\fB-C\fP) option\&'s inclusion of the
1950 per-directory \&.cvsignore file gets placed into your rules by putting the
1951 ":C" wherever you like in your filter rules\&.  Without this, rsync would
1952 add the dir-merge rule for the \&.cvsignore file at the end of all your other
1953 rules (giving it a lower priority than your command-line rules)\&.  For
1954 example:
1955 .PP 
1956 .RS 
1957 \f(CWcat <<EOT | rsync -avC --filter=\&'\&. -\&' a/ b\fP
1958 .br 
1959 \f(CW+ foo\&.o\fP
1960 .br 
1961 \f(CW:C\fP
1962 .br 
1963 \f(CW- *\&.old\fP
1964 .br 
1965 \f(CWEOT\fP
1966 .br 
1967 \f(CWrsync -avC --include=foo\&.o -f :C --exclude=\&'*\&.old\&' a/ b\fP
1968 .br 
1969 .RE 
1970 .PP 
1971 Both of the above rsync commands are identical\&.  Each one will merge all
1972 the per-directory \&.cvsignore rules in the middle of the list rather than
1973 at the end\&.  This allows their dir-specific rules to supersede the rules
1974 that follow the :C instead of being subservient to all your rules\&.  To
1975 affect the other CVS exclude rules (i\&.e\&. the default list of exclusions,
1976 the contents of $HOME/\&.cvsignore, and the value of $CVSIGNORE) you should
1977 omit the \fB-C\fP command-line option and instead insert a "-C" rule into
1978 your filter rules; e\&.g\&. "--filter=-C"\&.
1979 .PP 
1980 .SH "LIST-CLEARING FILTER RULE" 
1981 .PP 
1982 You can clear the current include/exclude list by using the "!" filter
1983 rule (as introduced in the FILTER RULES section above)\&.  The "current"
1984 list is either the global list of rules (if the rule is encountered while
1985 parsing the filter options) or a set of per-directory rules (which are
1986 inherited in their own sub-list, so a subdirectory can use this to clear
1987 out the parent\&'s rules)\&.
1988 .PP 
1989 .SH "ANCHORING INCLUDE/EXCLUDE PATTERNS" 
1990 .PP 
1991 As mentioned earlier, global include/exclude patterns are anchored at the
1992 "root of the transfer" (as opposed to per-directory patterns, which are
1993 anchored at the merge-file\&'s directory)\&.  If you think of the transfer as
1994 a subtree of names that are being sent from sender to receiver, the
1995 transfer-root is where the tree starts to be duplicated in the destination
1996 directory\&.  This root governs where patterns that start with a / match\&.
1997 .PP 
1998 Because the matching is relative to the transfer-root, changing the
1999 trailing slash on a source path or changing your use of the \fB--relative\fP
2000 option affects the path you need to use in your matching (in addition to
2001 changing how much of the file tree is duplicated on the destination
2002 host)\&.  The following examples demonstrate this\&.
2003 .PP 
2004 Let\&'s say that we want to match two source files, one with an absolute
2005 path of "/home/me/foo/bar", and one with a path of "/home/you/bar/baz"\&.
2006 Here is how the various command choices differ for a 2-source transfer:
2007 .PP 
2008 .RS 
2009 Example cmd: rsync -a /home/me /home/you /dest 
2010 .br 
2011 +/- pattern: /me/foo/bar 
2012 .br 
2013 +/- pattern: /you/bar/baz 
2014 .br 
2015 Target file: /dest/me/foo/bar 
2016 .br 
2017 Target file: /dest/you/bar/baz 
2018 .br 
2019 .RE 
2020 .PP 
2021 .RS 
2022 Example cmd: rsync -a /home/me/ /home/you/ /dest 
2023 .br 
2024 +/- pattern: /foo/bar               (note missing "me") 
2025 .br 
2026 +/- pattern: /bar/baz               (note missing "you") 
2027 .br 
2028 Target file: /dest/foo/bar 
2029 .br 
2030 Target file: /dest/bar/baz 
2031 .br 
2032 .RE 
2033 .PP 
2034 .RS 
2035 Example cmd: rsync -a --relative /home/me/ /home/you /dest 
2036 .br 
2037 +/- pattern: /home/me/foo/bar       (note full path) 
2038 .br 
2039 +/- pattern: /home/you/bar/baz      (ditto) 
2040 .br 
2041 Target file: /dest/home/me/foo/bar 
2042 .br 
2043 Target file: /dest/home/you/bar/baz 
2044 .br 
2045 .RE 
2046 .PP 
2047 .RS 
2048 Example cmd: cd /home; rsync -a --relative me/foo you/ /dest 
2049 .br 
2050 +/- pattern: /me/foo/bar      (starts at specified path) 
2051 .br 
2052 +/- pattern: /you/bar/baz     (ditto) 
2053 .br 
2054 Target file: /dest/me/foo/bar 
2055 .br 
2056 Target file: /dest/you/bar/baz 
2057 .br 
2058 .RE 
2059 .PP 
2060 The easiest way to see what name you should filter is to just
2061 look at the output when using \fB--verbose\fP and put a / in front of the name
2062 (use the \fB--dry-run\fP option if you\&'re not yet ready to copy any files)\&.
2063 .PP 
2064 .SH "PER-DIRECTORY RULES AND DELETE" 
2065 .PP 
2066 Without a delete option, per-directory rules are only relevant on the
2067 sending side, so you can feel free to exclude the merge files themselves
2068 without affecting the transfer\&.  To make this easy, the \&'e\&' modifier adds
2069 this exclude for you, as seen in these two equivalent commands:
2070 .PP 
2071 .RS 
2072 \f(CWrsync -av --filter=\&': \&.excl\&' --exclude=\&.excl host:src/dir /dest\fP
2073 .br 
2074 \f(CWrsync -av --filter=\&':e \&.excl\&' host:src/dir /dest\fP
2075 .br 
2076 .RE 
2077 .PP 
2078 However, if you want to do a delete on the receiving side AND you want some
2079 files to be excluded from being deleted, you\&'ll need to be sure that the
2080 receiving side knows what files to exclude\&.  The easiest way is to include
2081 the per-directory merge files in the transfer and use \fB--delete-after\fP,
2082 because this ensures that the receiving side gets all the same exclude
2083 rules as the sending side before it tries to delete anything:
2084 .PP 
2085 .RS 
2086 \f(CWrsync -avF --delete-after host:src/dir /dest\fP
2087 .RE 
2088 .PP 
2089 However, if the merge files are not a part of the transfer, you\&'ll need to
2090 either specify some global exclude rules (i\&.e\&. specified on the command
2091 line), or you\&'ll need to maintain your own per-directory merge files on
2092 the receiving side\&.  An example of the first is this (assume that the
2093 remote \&.rules files exclude themselves):
2094 .PP 
2095
2096 .nf 
2097  
2098 rsync -av --filter=\&': \&.rules\&' --filter=\&'\&. /my/extra\&.rules\&'
2099    --delete host:src/dir /dest
2100 .fi 
2101  
2102
2103 .PP 
2104 In the above example the extra\&.rules file can affect both sides of the
2105 transfer, but (on the sending side) the rules are subservient to the rules
2106 merged from the \&.rules files because they were specified after the
2107 per-directory merge rule\&.
2108 .PP 
2109 In one final example, the remote side is excluding the \&.rsync-filter
2110 files from the transfer, but we want to use our own \&.rsync-filter files
2111 to control what gets deleted on the receiving side\&.  To do this we must
2112 specifically exclude the per-directory merge files (so that they don\&'t get
2113 deleted) and then put rules into the local files to control what else
2114 should not get deleted\&.  Like one of these commands:
2115 .PP 
2116
2117 .nf 
2118  
2119     rsync -av --filter=\&':e /\&.rsync-filter\&' --delete \e 
2120         host:src/dir /dest
2121     rsync -avFF --delete host:src/dir /dest
2122 .fi 
2123  
2124
2125 .PP 
2126 .SH "BATCH MODE" 
2127 .PP 
2128 Batch mode can be used to apply the same set of updates to many
2129 identical systems\&. Suppose one has a tree which is replicated on a
2130 number of hosts\&.  Now suppose some changes have been made to this
2131 source tree and those changes need to be propagated to the other
2132 hosts\&. In order to do this using batch mode, rsync is run with the
2133 write-batch option to apply the changes made to the source tree to one
2134 of the destination trees\&.  The write-batch option causes the rsync
2135 client to store in a "batch file" all the information needed to repeat
2136 this operation against other, identical destination trees\&.
2137 .PP 
2138 To apply the recorded changes to another destination tree, run rsync
2139 with the read-batch option, specifying the name of the same batch
2140 file, and the destination tree\&.  Rsync updates the destination tree
2141 using the information stored in the batch file\&.
2142 .PP 
2143 For convenience, one additional file is creating when the write-batch
2144 option is used\&.  This file\&'s name is created by appending
2145 "\&.sh" to the batch filename\&.  The \&.sh file contains
2146 a command-line suitable for updating a destination tree using that
2147 batch file\&. It can be executed using a Bourne(-like) shell, optionally
2148 passing in an alternate destination tree pathname which is then used
2149 instead of the original path\&. This is useful when the destination tree
2150 path differs from the original destination tree path\&.
2151 .PP 
2152 Generating the batch file once saves having to perform the file
2153 status, checksum, and data block generation more than once when
2154 updating multiple destination trees\&. Multicast transport protocols can
2155 be used to transfer the batch update files in parallel to many hosts
2156 at once, instead of sending the same data to every host individually\&.
2157 .PP 
2158 Examples:
2159 .PP 
2160 .RS 
2161 \f(CW$ rsync --write-batch=foo -a host:/source/dir/ /adest/dir/\fP
2162 .br 
2163 \f(CW$ scp foo* remote:\fP
2164 .br 
2165 \f(CW$ ssh remote \&./foo\&.sh /bdest/dir/\fP
2166 .br 
2167 .RE 
2168 .PP 
2169 .RS 
2170 \f(CW$ rsync --write-batch=foo -a /source/dir/ /adest/dir/\fP
2171 .br 
2172 \f(CW$ ssh remote rsync --read-batch=- -a /bdest/dir/ <foo\fP
2173 .br 
2174 .RE 
2175 .PP 
2176 In these examples, rsync is used to update /adest/dir/ from /source/dir/
2177 and the information to repeat this operation is stored in "foo" and
2178 "foo\&.sh"\&.  The host "remote" is then updated with the batched data going
2179 into the directory /bdest/dir\&.  The differences between the two examples
2180 reveals some of the flexibility you have in how you deal with batches:
2181 .PP 
2182 .IP o 
2183 The first example shows that the initial copy doesn\&'t have to be
2184 local -- you can push or pull data to/from a remote host using either the
2185 remote-shell syntax or rsync daemon syntax, as desired\&.
2186 .IP o 
2187 The first example uses the created "foo\&.sh" file to get the right
2188 rsync options when running the read-batch command on the remote host\&.
2189 .IP o 
2190 The second example reads the batch data via standard input so that
2191 the batch file doesn\&'t need to be copied to the remote machine first\&.
2192 This example avoids the foo\&.sh script because it needed to use a modified
2193 \fB--read-batch\fP option, but you could edit the script file if you wished to
2194 make use of it (just be sure that no other option is trying to use
2195 standard input, such as the "\fB--exclude-from=-\fP" option)\&.
2196 .PP 
2197 Caveats:
2198 .PP 
2199 The read-batch option expects the destination tree that it is updating
2200 to be identical to the destination tree that was used to create the
2201 batch update fileset\&.  When a difference between the destination trees
2202 is encountered the update might be discarded with a warning (if the file
2203 appears to be up-to-date already) or the file-update may be attempted
2204 and then, if the file fails to verify, the update discarded with an
2205 error\&.  This means that it should be safe to re-run a read-batch operation
2206 if the command got interrupted\&.  If you wish to force the batched-update to
2207 always be attempted regardless of the file\&'s size and date, use the \fB-I\fP
2208 option (when reading the batch)\&.
2209 If an error occurs, the destination tree will probably be in a
2210 partially updated state\&. In that case, rsync can
2211 be used in its regular (non-batch) mode of operation to fix up the
2212 destination tree\&.
2213 .PP 
2214 The rsync version used on all destinations must be at least as new as the
2215 one used to generate the batch file\&.  Rsync will die with an error if the
2216 protocol version in the batch file is too new for the batch-reading rsync
2217 to handle\&.  See also the \fB--protocol\fP option for a way to have the
2218 creating rsync generate a batch file that an older rsync can understand\&.
2219 (Note that batch files changed format in version 2\&.6\&.3, so mixing versions
2220 older than that with newer versions will not work\&.)
2221 .PP 
2222 When reading a batch file, rsync will force the value of certain options
2223 to match the data in the batch file if you didn\&'t set them to the same
2224 as the batch-writing command\&.  Other options can (and should) be changed\&.
2225 For instance \fB--write-batch\fP changes to \fB--read-batch\fP,
2226 \fB--files-from\fP is dropped, and the
2227 \fB--filter\fP/\fB--include\fP/\fB--exclude\fP options are not needed unless
2228 one of the \fB--delete\fP options is specified\&.
2229 .PP 
2230 The code that creates the BATCH\&.sh file transforms any filter/include/exclude
2231 options into a single list that is appended as a "here" document to the
2232 shell script file\&.  An advanced user can use this to modify the exclude
2233 list if a change in what gets deleted by \fB--delete\fP is desired\&.  A normal
2234 user can ignore this detail and just use the shell script as an easy way
2235 to run the appropriate \fB--read-batch\fP command for the batched data\&.
2236 .PP 
2237 The original batch mode in rsync was based on "rsync+", but the latest
2238 version uses a new implementation\&.
2239 .PP 
2240 .SH "SYMBOLIC LINKS" 
2241 .PP 
2242 Three basic behaviors are possible when rsync encounters a symbolic
2243 link in the source directory\&.
2244 .PP 
2245 By default, symbolic links are not transferred at all\&.  A message
2246 "skipping non-regular" file is emitted for any symlinks that exist\&.
2247 .PP 
2248 If \fB--links\fP is specified, then symlinks are recreated with the same
2249 target on the destination\&.  Note that \fB--archive\fP implies
2250 \fB--links\fP\&.
2251 .PP 
2252 If \fB--copy-links\fP is specified, then symlinks are "collapsed" by
2253 copying their referent, rather than the symlink\&.
2254 .PP 
2255 rsync also distinguishes "safe" and "unsafe" symbolic links\&.  An
2256 example where this might be used is a web site mirror that wishes
2257 ensure the rsync module they copy does not include symbolic links to
2258 \fB/etc/passwd\fP in the public section of the site\&.  Using
2259 \fB--copy-unsafe-links\fP will cause any links to be copied as the file
2260 they point to on the destination\&.  Using \fB--safe-links\fP will cause
2261 unsafe links to be omitted altogether\&.  (Note that you must specify
2262 \fB--links\fP for \fB--safe-links\fP to have any effect\&.)
2263 .PP 
2264 Symbolic links are considered unsafe if they are absolute symlinks
2265 (start with \fB/\fP), empty, or if they contain enough \fB"\&.\&."\fP
2266 components to ascend from the directory being copied\&.
2267 .PP 
2268 Here\&'s a summary of how the symlink options are interpreted\&.  The list is
2269 in order of precedence, so if your combination of options isn\&'t mentioned,
2270 use the first line that is a complete subset of your options:
2271 .PP 
2272 .IP "\fB--copy-links\fP" 
2273 Turn all symlinks into normal files (leaving no
2274 symlinks for any other options to affect)\&.
2275 .PP 
2276 .IP "\fB--links --copy-unsafe-links\fP" 
2277 Turn all unsafe symlinks into files
2278 and duplicate all safe symlinks\&.
2279 .PP 
2280 .IP "\fB--copy-unsafe-links\fP" 
2281 Turn all unsafe symlinks into files, noisily
2282 skip all safe symlinks\&.
2283 .PP 
2284 .IP "\fB--links --safe-links\fP" 
2285 Duplicate safe symlinks and skip unsafe
2286 ones\&.
2287 .PP 
2288 .IP "\fB--links\fP" 
2289 Duplicate all symlinks\&.
2290 .PP 
2291 .SH "DIAGNOSTICS" 
2292 .PP 
2293 rsync occasionally produces error messages that may seem a little
2294 cryptic\&. The one that seems to cause the most confusion is "protocol
2295 version mismatch -- is your shell clean?"\&.
2296 .PP 
2297 This message is usually caused by your startup scripts or remote shell
2298 facility producing unwanted garbage on the stream that rsync is using
2299 for its transport\&. The way to diagnose this problem is to run your
2300 remote shell like this:
2301 .PP 
2302 .RS 
2303 \f(CWssh remotehost /bin/true > out\&.dat\fP
2304 .RE 
2305 .PP 
2306 then look at out\&.dat\&. If everything is working correctly then out\&.dat
2307 should be a zero length file\&. If you are getting the above error from
2308 rsync then you will probably find that out\&.dat contains some text or
2309 data\&. Look at the contents and try to work out what is producing
2310 it\&. The most common cause is incorrectly configured shell startup
2311 scripts (such as \&.cshrc or \&.profile) that contain output statements
2312 for non-interactive logins\&.
2313 .PP 
2314 If you are having trouble debugging filter patterns, then
2315 try specifying the \fB-vv\fP option\&.  At this level of verbosity rsync will
2316 show why each individual file is included or excluded\&.
2317 .PP 
2318 .SH "EXIT VALUES" 
2319 .PP 
2320 .IP "\fB0\fP" 
2321 Success
2322 .IP "\fB1\fP" 
2323 Syntax or usage error
2324 .IP "\fB2\fP" 
2325 Protocol incompatibility
2326 .IP "\fB3\fP" 
2327 Errors selecting input/output files, dirs
2328 .IP "\fB4\fP" 
2329 Requested action not supported: an attempt
2330 was made to manipulate 64-bit files on a platform that cannot support
2331 them; or an option was specified that is supported by the client and
2332 not by the server\&.
2333 .IP "\fB5\fP" 
2334 Error starting client-server protocol
2335 .IP "\fB6\fP" 
2336 Daemon unable to append to log-file
2337 .IP "\fB10\fP" 
2338 Error in socket I/O
2339 .IP "\fB11\fP" 
2340 Error in file I/O
2341 .IP "\fB12\fP" 
2342 Error in rsync protocol data stream
2343 .IP "\fB13\fP" 
2344 Errors with program diagnostics
2345 .IP "\fB14\fP" 
2346 Error in IPC code
2347 .IP "\fB20\fP" 
2348 Received SIGUSR1 or SIGINT
2349 .IP "\fB21\fP" 
2350 Some error returned by waitpid()
2351 .IP "\fB22\fP" 
2352 Error allocating core memory buffers
2353 .IP "\fB23\fP" 
2354 Partial transfer due to error
2355 .IP "\fB24\fP" 
2356 Partial transfer due to vanished source files
2357 .IP "\fB25\fP" 
2358 The --max-delete limit stopped deletions
2359 .IP "\fB30\fP" 
2360 Timeout in data send/receive
2361 .PP 
2362 .SH "ENVIRONMENT VARIABLES" 
2363 .PP 
2364 .IP "\fBCVSIGNORE\fP" 
2365 The CVSIGNORE environment variable supplements any
2366 ignore patterns in \&.cvsignore files\&. See the \fB--cvs-exclude\fP option for
2367 more details\&.
2368 .IP "\fBRSYNC_RSH\fP" 
2369 The RSYNC_RSH environment variable allows you to
2370 override the default shell used as the transport for rsync\&.  Command line
2371 options are permitted after the command name, just as in the \fB-e\fP option\&.
2372 .IP "\fBRSYNC_PROXY\fP" 
2373 The RSYNC_PROXY environment variable allows you to
2374 redirect your rsync client to use a web proxy when connecting to a
2375 rsync daemon\&. You should set RSYNC_PROXY to a hostname:port pair\&.
2376 .IP "\fBRSYNC_PASSWORD\fP" 
2377 Setting RSYNC_PASSWORD to the required
2378 password allows you to run authenticated rsync connections to an rsync
2379 daemon without user intervention\&. Note that this does not supply a
2380 password to a shell transport such as ssh\&.
2381 .IP "\fBUSER\fP or \fBLOGNAME\fP" 
2382 The USER or LOGNAME environment variables
2383 are used to determine the default username sent to an rsync daemon\&.
2384 If neither is set, the username defaults to "nobody"\&.
2385 .IP "\fBHOME\fP" 
2386 The HOME environment variable is used to find the user\&'s
2387 default \&.cvsignore file\&.
2388 .PP 
2389 .SH "FILES" 
2390 .PP 
2391 /etc/rsyncd\&.conf or rsyncd\&.conf
2392 .PP 
2393 .SH "SEE ALSO" 
2394 .PP 
2395 rsyncd\&.conf(5)
2396 .PP 
2397 .SH "BUGS" 
2398 .PP 
2399 times are transferred as unix time_t values
2400 .PP 
2401 When transferring to FAT filesystems rsync may re-sync
2402 unmodified files\&.
2403 See the comments on the \fB--modify-window\fP option\&.
2404 .PP 
2405 file permissions, devices, etc\&. are transferred as native numerical
2406 values
2407 .PP 
2408 see also the comments on the \fB--delete\fP option
2409 .PP 
2410 Please report bugs! See the website at
2411 http://rsync\&.samba\&.org/
2412 .PP 
2413 .SH "VERSION" 
2414 .PP 
2415 This man page is current for version 2\&.6\&.6 of rsync\&.
2416 .PP 
2417 .SH "CREDITS" 
2418 .PP 
2419 rsync is distributed under the GNU public license\&.  See the file
2420 COPYING for details\&.
2421 .PP 
2422 A WEB site is available at
2423 http://rsync\&.samba\&.org/\&.  The site
2424 includes an FAQ-O-Matic which may cover questions unanswered by this
2425 manual page\&.
2426 .PP 
2427 The primary ftp site for rsync is
2428 ftp://rsync\&.samba\&.org/pub/rsync\&.
2429 .PP 
2430 We would be delighted to hear from you if you like this program\&.
2431 .PP 
2432 This program uses the excellent zlib compression library written by
2433 Jean-loup Gailly and Mark Adler\&.
2434 .PP 
2435 .SH "THANKS" 
2436 .PP 
2437 Thanks to Richard Brent, Brendan Mackay, Bill Waite, Stephen Rothwell
2438 and David Bell for helpful suggestions, patches and testing of rsync\&.
2439 I\&'ve probably missed some people, my apologies if I have\&.
2440 .PP 
2441 Especial thanks also to: David Dykstra, Jos Backus, Sebastian Krahmer,
2442 Martin Pool, Wayne Davison, J\&.W\&. Schultz\&.
2443 .PP 
2444 .SH "AUTHOR" 
2445 .PP 
2446 rsync was originally written by Andrew Tridgell and Paul Mackerras\&.
2447 Many people have later contributed to it\&.
2448 .PP 
2449 Mailing lists for support and development are available at
2450 http://lists\&.samba\&.org