Debian Codegraph @

rsync.1

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