Linux Sync tool rsync?

Source: Internet
Author: User
Tags rsync

Linux Sync Tool rsync

First, rsync Command

The rsync command is a remote data synchronization tool that enables fast synchronization of files between multiple hosts via Lan/wan. rsync uses the so-called "rsync algorithm" to synchronize files between local and remote two hosts, which transmits only the different portions of two files, rather than the entire transfer every time, so it is quite fast. rsync is a very powerful tool, and its commands have a lot of feature options, and we have an analysis of its options below.

Grammar:

rsync [OPTION] ... SRC DEST

rsync [OPTION] ... SRC [[Email protected]]host:dest

rsync [OPTION] ... [[email protected]] HOST:SRC DEST

rsync [OPTION] ... [[email protected]] HOST::SRC DEST

rsync [OPTION] ... SRC [[Email protected]]host::D EST

rsync [OPTION] ... rsync://[[email protected]]host[:P ort]/src [DEST]

Second, to correspond to the above six kinds of command format, Rsync has six different modes of operation:

1. Copy the local file. This mode of operation is initiated when both the SRC and des path information do not contain a single colon ":" delimiter. such as: Rsync-a/data/backup

2. use a remote shell program (such as rsh, SSH) to copy the contents of the local machine to the remote machine. This mode is started when the DST path address contains a single colon ":" delimiter. such as: Rsync-avz *.c foo:src

3. use a remote shell program (such as rsh, SSH) to copy the contents of the remote machine to the local machine. This mode is started when the SRC address path contains a single colon ":" delimiter. such as: Rsync-avz foo:src/bar/data

4. copy files from the remote rsync server to the local machine. This mode is started when the SRC path information contains the "::" delimiter. such as: rsync-av [email Protected]::www/databack

5. copy files from the local machine to the remote rsync server. This mode is started when the DST path information contains the "::" delimiter. such as: Rsync-av/databack [Email protected]::www

6. List The files of the remote machine. This is similar to the rsync transfer, but only if the local machine information is omitted from the command. such as: Rsync-v rsync://192.168.8.100/www

Three, detailed options:

-V,--verbose verbose mode output.

-Q,--quiet thin output mode.

-C,--checksum turn on the check switch to force a checksum on the file transfer.

-A,--archive archive mode, which means that files are transferred recursively, and all file attributes are maintained, equal to-rlptgod.

-R,--recursive the subdirectory is processed in recursive mode.

-R,--relative Use relative path information.

-B,--backup Create the backup, that is, for the purpose already exists to have the same file name, the old file is renamed to ~filename. You can use the--suffix option to specify a different backup file prefix.

--backup-dir Store the backup files (such as ~filename) in the directory.

-suffix=suffix defines the backup file prefix.

-U,--update just update, that is, skip all the files that already exist in DST, and the file time is later than the file to be backed up, without overwriting the updated file.

-L,--links keep the soft link knot.

-L,--copy-links treat soft links like regular files.

--copy-unsafe-links simply copy links to a link other than the SRC path directory tree.

--safe-links Ignore links to links outside the SRC Path directory tree.

-H,--hard-links Keep Hard links.

-P,--perms Keep file permissions.

-O,--owner Keep the file owner information.

-G,--group Keep the file group information.

-D,--devices Keep device file information.

-T,--times Keep the file time information.

-S,--sparse special processing of sparse files to save DST space.

-N,--dry-run the reality of which files will be transmitted.

-W,--whole-file Copy the file without incremental detection.

-X,--one-file-system do not cross file system boundaries.

-B,--block-size=size The block size used by the test algorithm is 700 bytes by default.

-E,--rsh=command Specifies that data is synchronized using RSH and SSH.

--rsync-path=path Specifies the path information for the rsync command located on the remote server.

-C,--cvs-exclude use the same method as CVs to automatically ignore files, which are used to exclude files that you do not want to transfer.

--existing just update those files that already exist in DST without backing up those newly created files.

--delete Delete files that do not have src in DST.

--delete-excluded also delete those files that are excluded by the option specified by the Receive side.

--delete-after after the transfer is finished, delete again.

--ignore-errors a timely IO error is also deleted.

--max-delete=num Delete a maximum of num files.

--partial keep files that are not fully transmitted for any reason, in order to expedite subsequent transmissions.

--force forces the directory to be deleted, even if it is not empty.

--numeric-ids do not match the user and group IDs of numbers to user names and group names.

--timeout=time IP the time-out, in seconds.

-I.,--ignore-times do not skip files that have the same time and length.

--size-only When deciding whether to back up a file, just look at the file size regardless of file time.

--modify-window=num the timestamp window, which determines whether the file is used in the same time, defaults to 0.

- T--temp-dir=dir Create a temporary file in Dir.

--compare-dest=dir also compare the files in dir to determine if a backup is required.

- P equivalent to--partial. --progress shows the backup process.

-Z,--compress The files that are backed up are compressed when they are transferred.

--exclude=pattern Specifies to exclude file patterns that do not need to be transferred.

--include=pattern Specifies the file mode that is not excluded and that needs to be transferred.

--exclude-from=file excludes files in the specified schema in file.

--include-from=file files that do not exclude file specified pattern matching are not excluded.

--version print version information.

--address bind to a specific address.

--config=file specify a different configuration file, and do not use the default rsyncd.conf file.

--port=port Specify a different rsync service port.

--blocking-io use blocking IO for remote shells.

-stats gives the transfer status of some files.

--progress the actual transmission process at the time of transmission.

--log-format=format Specifies the log file format.

--password-file=file get the password from file.

--bwlimit=kbps limit I/O bandwidth, Kbytes per second.

-H,--help Displays help information.


Linux Sync tool rsync?

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.