Linux command-rsync command

Source: Internet
Author: User
Tags file permissions rsync

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 Destrsync [OPTION] ... SRC [[Email Protected]]host:destrsync [OPTION] ... [[email protected]] HOST:SRC Destrsync [OPTION] ... [[email protected]] HOST::SRC Destrsync [OPTION] ... SRC [[Email protected]]host::D estrsync [OPTION] ... rsync://[[Email protected]]host[:P ORT]/SRC [ DEST]

There are six different modes of operation for Rsync , which corresponds to the above six command formats:

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

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

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

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

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

The list of files for the remote machine is listed. 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.78.192/www

Parameter 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 to transfer files recursively and keep all file attributes equal to-Rlptgod. -R,--recursive subdirectories are processed in recursive mode. -R,--relative uses relative path information. -B,--backup creates a backup, that is, the old file is renamed to ~filename when the same file name exists for the purpose. Can be used--the suffix option to specify a different backup file prefix. --backup-dir store backup files (such as ~filename) in the directory. -suffix=SUFFIX defines the backup file prefix. -U,--Update only updates, that is, skips all existing DST, and the file time is later than the file to be backed up, and does not overwrite the updated file. -L,--links Keep Soft links. -L,--copy-links treat soft links like regular files. --copy-unsafe-links only copy links that are outside the SRC Path directory tree. --safe-Links ignores links to nodes other than the SRC path directory tree. -H,--hard-links retain hard links. -P,--perms maintain file permissions. -O,--owner keeps the file master information. -G,--Group holds the file as a grouping of information. -D,--devices Keep the device file information. -T,--times Keep file time information. -S,--sparse special processing of sparse files to save DST space. -N,--dry-run reality which files will be transmitted. -W,--whole-file copies files without incremental detection. -X,--one-file-System does not cross file system boundaries. -B,--block-size=the size test algorithm uses a block size that defaults to 700 bytes. -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 uses the same method as CVs to automatically ignore files, which are used to exclude files that you do not want to transfer. --existing only updates those files that already exist in DST, without backing up those newly created files. --Delete deletes those files that are not in the DST Src. --delete-excluded also deletes those files that are excluded by the option specified by the Receive side. --delete-after the transfer is finished, delete again. --ignore-errors timely IO errors are also deleted. --max-delete=num Deletes a maximum of num files. --Partialkeep files that are not fully transmitted for any reason, in order to expedite subsequent transmissions. --force forces the removal of the directory, even if it is not empty. --numeric-IDs does not match the user and group IDs of numbers to user names and group names. --timeout=time IP timeout, 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 Determines whether the file is time-stamped with the time Stamp window, which defaults to 0. -T--temp-dir=dir creates a temporary file in Dir. --compare-dest=dir also compares the files in dir to determine if a backup is required. -P is equivalent to--Partial. --Progress shows the backup process. -Z,--compress the files that are backed up are compressed at the time of transmission. --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 does not exclude files that specify pattern matching. --version Prints the release information. --address is bound to a specific location. --config=File Specifies a different configuration file and does not use the default rsyncd.conf file. --port=Port Specifies the other rsync service ports. --blocking-io uses blocking IO on the remote shell. -stats gives the transfer status of some files. --progress the actual transmission process during transmission. --log-format=format Specifies the log file formats. --password-file=file gets the password from file. --bwlimit=kbps Limit i/o bandwidth, Kbytes per second. -H,--help displays help information.

Linux command-rsync command

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.