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