Debian Codegraph @

rsync.1.md

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