The
rsync command format can be in the following six ways:
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] The
corresponds to the above six command formats, and Rsync has six different modes of operation:
1) Copy Local files. This mode of operation is initiated when both the SRC and des path information do not contain a single colon ":" delimiter. For example, Rsync-a/data/backup
2) uses 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. For example, Rsync-avz *.c foo:src
3) uses 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) copies files from the local machine to the remote rsync server. This mode is started when the DST path information contains the "::" delimiter. For example: Rsync-av/databack [email protected]::www
6] Lists the list of files for 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://172.16.78.192/www
The specific explanations for the rsync parameters are as follows:
-v,–verbose Verbose mode output
-q,–quiet Thin Output mode
-c,–checksum turn on the check switch to force verification of file transfers
-a,–archive archive mode, which means that files are transferred recursively, and all file attributes are maintained, equal to-rlptgod
-r,–recursive Recursive mode for subdirectories
-r,–relative Using relative path information
-b,–backup Create a backup, that is, for the purpose already exists with 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 backup files (such as ~filename) in the directory.
-suffix=suffix Defining backup File prefixes
-u,–update only updates, which is to skip all the files that already exist in DST, and the file time is later than the file to be backed up. (Does not overwrite the updated file)
-l,–links retaining Soft link knot
-l,–copy-links to handle soft links like regular files
–copy-unsafe-links only copies links to links outside the SRC Path directory tree
–safe-links ignoring links to the SRC Path directory tree
-h,–hard-links Retaining Hard Links
-p,–perms Maintaining file permissions
-o,–owner Keep File owner information
-g,–group Maintaining file group information
-d,–devices Maintaining device file information
-t,–times Keeping 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 copy files without incremental detection
-x,–one-file-system do not cross file system boundaries
The block size used by the-b,–block-size=size test algorithm is 700 bytes by default
-E,–RSH=COMMAND Specifies data synchronization using RSH and SSH
–rsync-path=path Specify the path information for the rsync command on the remote server
-c,–cvs-exclude uses the same method as CVs to automatically ignore files 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 Delete 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 transfer ends after removal
–ignore-errors Timely IO errors are also deleted
–max-delete=num deleting NUM files up to a maximum
–partial retains files that are not fully transmitted for any reason, to expedite subsequent transmissions
–force forcibly delete a directory, even if it is not empty
–numeric-ids does not match the user and group ID of a number to a user name and group name
–timeout=time IP time-out, in seconds
-i,–ignore-times don't 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 creating a temporary file in Dir
–compare-dest=dir also compares the files in DIR to determine if a backup is required
-p equivalent to –partial
–progress Show Backup process
-z,–compress compressing the backed-up files while they are being transmitted
–exclude=pattern specify to exclude file modes that do not need to be transferred
–include=pattern specifies file modes that need to be transferred without exclusion
–exclude-from=file exclude files in the specified schema in file
–include-from=file does not exclude files that specify pattern matching
–version Print version Information
–address binding to a specific address
–config=file specify a different configuration file, do not use the default rsyncd.conf file
–port=port Specify a different rsync service port
–blocking-io using blocking IO for remote shells
-stats gives the transfer status of some files
–progress in the transmission of the real-time transmission process
–log-format=format specifying the log file format
–password-file=file get the password from file
–bwlimit=kbps limit I/O bandwidth, Kbytes per second
-H,–HELP Display Help information
Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.
Use of the rsync command