a fast, versatile, remote (and local) file-copying tool
|
-n, --dry-run
This makes rsync perform a trial run that doesn’t make any changes (and produces mostly the same
output as a real run). It is most commonly used in combination with the -v, --verbose and/or -i,
--itemize-changes options to see what an rsync command is going to do before one actually runs it.
The output of --itemize-changes is supposed to be exactly the same on a dry run and a subsequent
real run (barring intentional trickery and system call failures); if it isn’t, that’s a bug.
Other output should be mostly unchanged, but may differ in some areas. Notably, a dry run does
not send the actual data for file transfers, so --progress has no effect, the "bytes sent", "bytes
received", "literal data", and "matched data" statistics are too small, and the "speedup" value is
equivalent to a run where no file transfers were needed.
|
--remove-source-files
This tells rsync to remove from the sending side the files (meaning non-directories) that are a
part of the transfer and have been successfully duplicated on the receiving side.
Note that you should only use this option on source files that are quiescent. If you are using
this to move files that show up in a particular directory over to another host, make sure that the
finished files get renamed into the source directory, not directly written into it, so that rsync
can’t possibly transfer a file that is not yet fully written. If you can’t first write the files
into a different directory, you should use a naming idiom that lets rsync avoid transferring files
that are not yet finished (e.g. name the file "foo.new" when it is written, rename it to "foo"
when it is done, and then use the option --exclude='*.new' for the rsync transfer).
|
-a, --archive
This is equivalent to -rlptgoD. It is a quick way of saying you want recursion and want to
preserve almost everything (with -H being a notable omission). The only exception to the above
equivalence is when --files-from is specified, in which case -r is not implied.
Note that -a does not preserve hardlinks, because finding multiply-linked files is expensive. You
must separately specify -H.
|
-v, --verbose
This option increases the amount of information you are given during the transfer. By default,
rsync works silently. A single -v will give you information about what files are being transferred
and a brief summary at the end. Two -v options will give you information on what files are being
skipped and slightly more information at the end. More than two -v options should only be used if
you are debugging rsync.
Note that the names of the transferred files that are output are done using a default --out-format
of "%n%L", which tells you just the name of the file and, if the item is a link, where it points.
At the single -v level of verbosity, this does not mention when a file gets its attributes
changed. If you ask for an itemized list of changed attributes (either --itemize-changes or
adding "%i" to the --out-format setting), the output (on the client) increases to mention all
items that are changed in any way. See the --out-format option for more details.
|
-z, --compress
With this option, rsync compresses the file data as it is sent to the destination machine, which
reduces the amount of data being transmitted -- something that is useful over a slow connection.
Note that this option typically achieves better compression ratios than can be achieved by using a
compressing remote shell or a compressing transport because it takes advantage of the implicit
information in the matching data blocks that are not explicitly sent over the connection.
See the --skip-compress option for the default list of file suffixes that will not be compressed.
|
-P The -P option is equivalent to --partial --progress. Its purpose is to make it much easier to
specify these two options for a long transfer that may be interrupted.
|
-h, --human-readable
Output numbers in a more human-readable format. This makes big numbers output using larger units,
with a K, M, or G suffix. If this option was specified once, these units are K (1000), M
(1000*1000), and G (1000*1000*1000); if the option is repeated, the units are powers of 1024
instead of 1000.
|