system: using
a remote‐shell program as the transport (such as ssh or rsh) or contact‐
ing an rsync daemon directly via TCP. The remote‐shell transport is
used whenever the source or destination path contains a single colon (:)
separator after a host specification. Contacting an rsync daemon di‐
rectly happens when the source or destination path contains a double
colon (::) separator after a host specification, OR when an rsync:// URL
is specified (see also the USING RSYNC‐DAEMON FEATURES VIA A REMOTE‐
SHELL CONNECTION section for an exception to this latter rule).
As a special case, if a single source arg is specified without a desti‐
nation, the files are listed in an output format similar to "ls -l".
As expected, if neither the source or destination path specify a remote
host, the copy occurs locally (see also the --list‐only option).
Rsync refers to the local side as the client and the remote side as the
server. Don’t confuse server with an rsync daemon. A daemon is always
a server, but a server can be either a daemon or a remote‐shell spawned
process.
SETUP
See the file README.md for installation instructions.
Once installed, you can use rsync to any machine that you can access via
a remote shell (as well as some that you can access using the rsync dae‐
mon‐mode protocol). For remote transfers, a modern rsync uses ssh for
its communications, but it may have been configured to use a different
remote shell by default, such as rsh or remsh.
You can also specify any remote shell you like, either by using the -e
command line option, or by setting the RSYNC_RSH environment variable.
Note that rsync must be installed on both the source and destination ma‐
chines.
USAGE
You use rsync in the same way you use rcp. You must specify a source
and a destination, one of which may be remote.
Perhaps the best way to explain the syntax is with some examples:
rsync ‐t *.c foo:src/
This would transfer all files matching the pattern *.c from the current
directory to the directory src on the machine foo. If any of the files
already exist on the remote system then the rsync remote‐update protocol
is used to update the file by sending only the differences in the data.
Note that the expansion of wildcards on the command‐line (*.c) into a
list of files is handled by the shell before it runs rsync and not by
rsync itself (exactly the same as all other Posix‐style programs).
rsync ‐avz foo:src/bar /data/tmp
This would recursively transfer all files from the directory src/bar on
the machine foo into the /data/tmp/bar directory on the local machine.
The files are transferred in archive mode, which ensures that symbolic
links, devices, attributes, permissions, ownerships, etc. are preserved
in the transfer. Additionally, compression will be used to reduce the
size of data portions of the transfer.
rsync ‐avz foo:src/bar/ /data/tmp
A trailing slash on the source changes this behavior to avoid creating
an additional directory level at the destination. You can think of a
trailing / on a source as meaning "copy the contents of this directory"
as opposed to "copy the directory by name", but in both cases the at‐
tributes of the containing directory are transferred to the containing
directory on the destination. In other words, each of the following
commands copies the files in the same way, including their setting of
the attributes of /dest/foo:
rsync ‐av /src/foo /dest
rsync ‐av /src/foo/ /dest/foo
Note also that host and module references don’t require a trailing