Debian Codegraph @

rsync.1.html

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