rsync

Name

rsync -- faster, flexible replacement for rcp

Synopsis

rsync [OPTION]... SRC [SRC]... [USER@]HOST:DEST
rsync [OPTION]... [USER@]HOST:SRC DEST
rsync [OPTION]... SRC [SRC]... DEST
rsync [OPTION]... [USER@]HOST::SRC [DEST]
rsync [OPTION]... SRC [SRC]... [USER@]HOST::DEST
rsync [OPTION]... rsync://[USER@]HOST[:PORT]/SRC [DEST]

Description

rsync is a program that behaves in much the same way that rcp does, but has many more options and uses the rsync remote-update protocol to greatly speedup file transfers when the destination file already exists.

The rsync remote-update protocol allows rsync to transfer just the differences between two sets of files across the network link, using an efficient checksum-search algorithm described in the technical report that accompanies this package.

Standard Options

--version

print the rsync version number and exit

-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 flags will give you information on what files are being skipped and slightly more information at the end.

-q, --quiet

This option decreases the amount of information you are given during the transfer, notably suppressing information messages from the remote server. This flag is useful when invoking rsync from cron.

-I, --ignore-times

Normally rsync will skip any files that are already the same length and have the same time-stamp. This option turns off this behavior.

-c, --checksum

This forces the sender to checksum all files using a 128-bit MD4 checksum before transfer. The checksum is then explicitly checked on the receiver and any files of the same name which already exist and have the same checksum and size on the receiver are skipped. This option can be quite slow.

-a, --archive

A shortcut for specifying recursion and to preserve all attributes.

-r, --recursive

This tells rsync to copy directories recursively. If you donīt specify this then rsync wonīt copy directories at all.

-R, --relative

Use relative paths. This means that the full path names specified on the command line are sent to the server rather than just the last parts of the filenames.

-b, --backup

With this option preexisting destination files are renamed with a ~ extension as each file is transferred. You can control the backup suffix using the --suffix option.

--backup-dir=DIR

In combination with the --backup option, this tells rsync to store all backups in the specified directory. This is very useful for incremental backups.

--suffix=SUFFIX

This option allows you to override the default backup suffix used with the -b option. The default is a ~.

-u, --update

This forces rsync to skip any files for which the destination file already exists and has a date later than the source file.

-l, --links

This tells rsync to recreate symbolic links on the remote system to be the same as the local system. Without this option, all symbolic links are skipped.

-L, --copy-links

This tells rsync to transfer the file referenced by a symbolic link, rather than recreating the link.

--copy-unsafe-links

This tells rsync to treat symbolic links that point outside the source tree like ordinary files. Absolute symlinks are also treated like ordinary files, and so are any symlinks in the source path itself when --relative is used.

--safe-links

This tells rsync to ignore any symbolic links which point outside the destination tree. All absolute symlinks are also ignored.

-H, --hard-links

This tells rsync to recreate hard links on the remote system to be the same as the local system. Without this option hard links are treated like regular files.

-W, --whole-file

With this option the incremental rsync algorithm is not used and the whole file is sent as-is instead. This may be useful when using rsync with a local machine.

-p, --perms

This option causes rsync to update the remote permissions to be the same as the local permissions.

-o, --owner

This option causes rsync to update the remote owner of the file to be the same as the local owner. This is only available to the super-user. Note that if the source system is a daemon using chroot, the --numeric-ids option is implied because the source system cannot get access to the usernames.

-g, --group

This option causes rsync to update the remote group of the file to be the same as the local group. If the receiving system is not running as the super-user, only groups that the receiver is a member of will be preserved (by group name, not group id number).

-D, --devices

This option causes rsync to transfer character and block device information to the remote system to recreate these devices. This option is only available to the super-user.

-t, --times

This tells rsync to transfer modification times along with the files and update them on the remote system.

-n, --dry-run

This tells rsync to not do any file transfers, instead it will just report the actions it would have taken.

-x, --one-file-system

This tells rsync not to cross filesystem boundaries when recursing.

--existing

This tells rsync not to create any new files - only update files that already exist on the destination.

--max-delete=NUM

This tells rsync not to delete more than NUM files or directories.

--delete

This tells rsync to delete any files on the receiving side that arenīt on the sending side. Files that are excluded from transfer are excluded from being deleted unless you use --delete-excluded.

This option has no effect if directory recursion is not selected.

--delete-excluded

In addition to deleting the files on the receiving side that are not on the sending side, this tells rsync to also delete any files on the receiving side that are excluded (see --exclude).

--delete-after

By default rsync does file deletions before transferring files to try to ensure that there is sufficient space on the receiving filesystem. If you want to delete after transferring then use the --delete-after switch.

-B, --block-size=BLOCKSIZE

This controls the block size used in the rsync algorithm. See the technical report for details.

-e, --rsh=COMMAND

This option allows you to specify the remote shell program to use for communication between the local and remote copies of rsync.

You can also choose the remote shell program using the RSYNC_RSH environment variable.

--rsync-path=PATH

Use this to specify the path to the copy of rsync on the remote machine. Note that this is the full path to the binary, not just the directory that the binary is in.

--exclude=PATTERN

This option allows you to selectively exclude certain files from the list of files to be transferred.

You may use as many --exclude options on the command line as you like to build up the list of files to exclude.

--exclude-from=FILE

This option is similar to the --exclude option, but instead it adds all exclude patterns listed in the file FILE to the exclude list. Blank lines in FILE and lines starting with ī;ī or ī#ī are ignored.

--include=PATTERN

This option tells rsync to not exclude the specified pattern of filenames. This is useful as it allows you to build up quite complex exclude/include rules.

--include-from=FILE

This specifies a list of include patterns from a file.

-T, --temp-dir=DIR

This option instructs rsync to use DIR as a scratch directory when creating temporary copies of the files transferred on the receiving side. The default behavior is to create the temporary files in the receiving directory.

-z, --compress

With this option, rsync compresses any data from the source file(s) which it sends to the destination machine.

--numeric-ids

With this option rsync will transfer numeric group and user ids rather than using user and group names and mapping them at both ends.

By default rsync will use the user name and group name to determine what ownership to give files. The special uid 0 and the special group 0 are never mapped via user/group names even if the --numeric-ids option is not specified.

--timeout=TIMEOUT

This option allows you to set a maximum IO timeout in seconds. If no data is transferred for the specified time then rsync will exit. The default is 0, which means no timeout.

--port=PORT

This specifies an alternate TCP port number to use rather than the default port 873. This only has effect when using rsync to connect to a remote rsync daemon.

--blocking-io

This specifies whether rsync will use blocking IO when launching a remote shell transport. You may find this is needed for some remote shells that canīt handle the default non-blocking IO.

--partial

By default, rsync will delete any partially transferred file if the transfer is interrupted. In some circumstances it is more desirable to keep partially transferred files. Using the --partial option tells rsync to keep the partial file which should make a subsequent transfer of the rest of the file much faster.

--progress

This option tells rsync to print information showing the progress of the transfer.

-P

Equivalent to --partial --progress

--password-file

This option allows you to provide a password in a file for accessing a remote rsync server. Note that this option is only useful when accessing a rsync server using the built in transport, not when using a remote shell as the transport. The file must not be world readable. It should contain just the password as a single line.

--bwlimit=KBPS

This option allows you to specify a maximum transfer rate in kilobytes per second. A value of zero specifies no limit.