⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 rsync.1

📁 Rsync 3.0.5 source code
💻 1
📖 第 1 页 / 共 5 页
字号:
print the rsync version number and exit..IP .IP "\fB\-v, \-\-verbose\fP"This option increases the amount of information youare given during the transfer.  By default, rsync works silently. Asingle \fB\-v\fP will give you information about what files are beingtransferred and a brief summary at the end. Two \fB\-v\fP options will give youinformation on what files are being skipped and slightly moreinformation at the end. More than two \fB\-v\fP options should only be used ifyou are debugging rsync..IP Note that the names of the transferred files that are output are done usinga default \fB\-\-out\-format\fP of \(lq%n%L\(rq, which tells you just the name of thefile and, if the item is a link, where it points.  At the single \fB\-v\fPlevel of verbosity, this does not mention when a file gets its attributeschanged.  If you ask for an itemized list of changed attributes (either\fB\-\-itemize\-changes\fP or adding \(lq%i\(rq to the \fB\-\-out\-format\fP setting), theoutput (on the client) increases to mention all items that are changed inany way.  See the \fB\-\-out\-format\fP option for more details..IP .IP "\fB\-q, \-\-quiet\fP"This option decreases the amount of information youare given during the transfer, notably suppressing information messagesfrom the remote server. This option is useful when invoking rsync fromcron..IP .IP "\fB\-\-no\-motd\fP"This option affects the information that is outputby the client at the start of a daemon transfer.  This suppresses themessage-of-the-day (MOTD) text, but it also affects the list of modulesthat the daemon sends in response to the \(lqrsync host::\(rq request (due toa limitation in the rsync protocol), so omit this option if you want torequest the list of modules from the daemon..IP .IP "\fB\-I, \-\-ignore\-times\fP"Normally rsync will skip any files that arealready the same size and have the same modification timestamp.This option turns off this \(lqquick check\(rq behavior, causing all files tobe updated..IP .IP "\fB\-\-size\-only\fP"This modifies rsync's \(lqquick check\(rq algorithm forfinding files that need to be transferred, changing it from the default oftransferring files with either a changed size or a changed last-modifiedtime to just looking for files that have changed in size.  This is usefulwhen starting to use rsync after using another mirroring system which maynot preserve timestamps exactly..IP .IP "\fB\-\-modify\-window\fP"When comparing two timestamps, rsync treats thetimestamps as being equal if they differ by no more than the modify-windowvalue.  This is normally 0 (for an exact match), but you may find it usefulto set this to a larger value in some situations.  In particular, whentransferring to or from an MS Windows FAT filesystem (which representstimes with a 2-second resolution), \fB\-\-modify\-window=1\fP is useful(allowing times to differ by up to 1 second)..IP .IP "\fB\-c, \-\-checksum\fP"This changes the way rsync checks if the files havebeen changed and are in need of a transfer.  Without this option, rsyncuses a \(lqquick check\(rq that (by default) checks if each file's size and timeof last modification match between the sender and receiver.  This optionchanges this to compare a 128-bit MD4 checksum for each file that has amatching size.  Generating the checksums means that both sides will expenda lot of disk I/O reading all the data in the files in the transfer (andthis is prior to any reading that will be done to transfer changed files),so this can slow things down significantly..IP The sending side generates its checksums while it is doing the file-systemscan that builds the list of the available files.  The receiver generatesits checksums when it is scanning for changed files, and will checksum anyfile that has the same size as the corresponding sender's file:  files witheither a changed size or a changed checksum are selected for transfer..IP Note that rsync always verifies that each \fItransferred\fP file wascorrectly reconstructed on the receiving side by checking a whole-filechecksum that is generated as the file is transferred, but thatautomatic after-the-transfer verification has nothing to do with thisoption's before-the-transfer \(lqDoes this file need to be updated?\(rq check..IP .IP "\fB\-a, \-\-archive\fP"This is equivalent to \fB\-rlptgoD\fP. It is a quickway of saying you want recursion and want to preserve almosteverything (with \-H being a notable omission).The only exception to the above equivalence is when \fB\-\-files\-from\fP isspecified, in which case \fB\-r\fP is not implied..IP Note that \fB\-a\fP \fBdoes not preserve hardlinks\fP, becausefinding multiply-linked files is expensive.  You must separatelyspecify \fB\-H\fP..IP .IP "\-\-no\-OPTION"You may turn off one or more implied options by prefixingthe option name with \(lqno\-\(rq.  Not all options may be prefixed with a \(lqno\-\(rq:only options that are implied by other options (e.g. \fB\-\-no\-D\fP,\fB\-\-no\-perms\fP) or have different defaults in various circumstances(e.g. \fB\-\-no\-whole\-file\fP, \fB\-\-no\-blocking\-io\fP, \fB\-\-no\-dirs\fP).  You mayspecify either the short or the long option name after the \(lqno\-\(rq prefix(e.g. \fB\-\-no\-R\fP is the same as \fB\-\-no\-relative\fP)..IP For example: if you want to use \fB\-a\fP (\fB\-\-archive\fP) but don't want\fB\-o\fP (\fB\-\-owner\fP), instead of converting \fB\-a\fP into \fB\-rlptgD\fP, youcould specify \fB\-a \-\-no\-o\fP (or \fB\-a \-\-no\-owner\fP)..IP The order of the options is important:  if you specify \fB\-\-no\-r \-a\fP, the\fB\-r\fP option would end up being turned on, the opposite of \fB\-a \-\-no\-r\fP.Note also that the side-effects of the \fB\-\-files\-from\fP option are NOTpositional, as it affects the default state of several options and slightlychanges the meaning of \fB\-a\fP (see the \fB\-\-files\-from\fP option for moredetails)..IP .IP "\fB\-r, \-\-recursive\fP"This tells rsync to copy directoriesrecursively.  See also \fB\-\-dirs\fP (\fB\-d\fP)..IP Beginning with rsync 3.0.0, the recursive algorithm used is now anincremental scan that uses much less memory than before and begins thetransfer after the scanning of the first few directories have beencompleted.  This incremental scan only affects our recursion algorithm, anddoes not change a non-recursive transfer.  It is also only possible whenboth ends of the transfer are at least version 3.0.0..IP Some options require rsync to know the full file list, so these optionsdisable the incremental recursion mode.  These include: \fB\-\-delete\-before\fP,\fB\-\-delete\-after\fP, \fB\-\-prune\-empty\-dirs\fP, and \fB\-\-delay\-updates\fP.Because of this, the default delete mode when you specify \fB\-\-delete\fP is now\fB\-\-delete\-during\fP when both ends of the connection are at least 3.0.0(use \fB\-\-del\fP or \fB\-\-delete\-during\fP to request this improved deletion modeexplicitly).  See also the \fB\-\-delete\-delay\fP option that is a better choicethan using \fB\-\-delete\-after\fP..IP Incremental recursion can be disabled using the \fB\-\-no\-inc\-recursive\fPoption or its shorter \fB\-\-no\-i\-r\fP alias..IP .IP "\fB\-R, \-\-relative\fP"Use relative paths. This means that the full pathnames specified on the command line are sent to the server rather thanjust the last parts of the filenames. This is particularly useful whenyou want to send several different directories at the same time. Forexample, if you used this command:.IP .RS \f(CW   rsync \-av /foo/bar/baz.c remote:/tmp/\fP.RE.IP \&... this would create a file named baz.c in /tmp/ on the remotemachine. If instead you used.IP .RS \f(CW   rsync \-avR /foo/bar/baz.c remote:/tmp/\fP.RE.IP then a file named /tmp/foo/bar/baz.c would be created on the remotemachine, preserving its full path.  These extra path elements are called\(lqimplied directories\(rq (i.e. the \(lqfoo\(rq and the \(lqfoo/bar\(rq directories in theabove example)..IP Beginning with rsync 3.0.0, rsync always sends these implied directories asreal directories in the file list, even if a path element is really asymlink on the sending side.  This prevents some really unexpectedbehaviors when copying the full path of a file that you didn't realize hada symlink in its path.  If you want to duplicate a server-side symlink,include both the symlink via its path, and referent directory via its realpath.  If you're dealing with an older rsync on the sending side, you mayneed to use the \fB\-\-no\-implied\-dirs\fP option..IP It is also possible to limit the amount of path information that is sent asimplied directories for each path you specify.  With a modern rsync on thesending side (beginning with 2.6.7), you can insert a dot and a slash intothe source path, like this:.IP .RS \f(CW   rsync \-avR /foo/./bar/baz.c remote:/tmp/\fP.RE.IP That would create /tmp/bar/baz.c on the remote machine.  (Note that thedot must be followed by a slash, so \(lq/foo/.\(rq would not be abbreviated.)(2) For older rsync versions, you would need to use a chdir to limit thesource path.  For example, when pushing files:.IP .RS \f(CW   (cd /foo; rsync \-avR bar/baz.c remote:/tmp/) \fP.RE.IP (Note that the parens put the two commands into a sub-shell, so that the\(lqcd\(rq command doesn't remain in effect for future commands.)If you're pulling files from an older rsync, use this idiom (but onlyfor a non-daemon transfer):.IP .RS \f(CW   rsync \-avR \-\-rsync\-path="cd /foo; rsync" \e \fP.br \f(CW       remote:bar/baz.c /tmp/\fP.RE.IP .IP "\fB\-\-no\-implied\-dirs\fP"This option affects the default behavior of the\fB\-\-relative\fP option.  When it is specified, the attributes of the implieddirectories from the source names are not included in the transfer.  Thismeans that the corresponding path elements on the destination system areleft unchanged if they exist, and any missing implied directories arecreated with default attributes.  This even allows these implied pathelements to have big differences, such as being a symlink to a directory onthe receiving side..IP For instance, if a command-line arg or a files-from entry told rsync totransfer the file \(lqpath/foo/file\(rq, the directories \(lqpath\(rq and \(lqpath/foo\(rqare implied when \fB\-\-relative\fP is used.  If \(lqpath/foo\(rq is a symlink to\(lqbar\(rq on the destination system, the receiving rsync would ordinarilydelete \(lqpath/foo\(rq, recreate it as a directory, and receive the file intothe new directory.  With \fB\-\-no\-implied\-dirs\fP, the receiving rsync updates\(lqpath/foo/file\(rq using the existing path elements, which means that the fileends up being created in \(lqpath/bar\(rq.  Another way to accomplish this linkpreservation is to use the \fB\-\-keep\-dirlinks\fP option (which will alsoaffect symlinks to directories in the rest of the transfer)..IP When pulling files from an rsync older than 3.0.0, you may need to use thisoption if the sending side has a symlink in the path you request and youwish the implied directories to be transferred as normal directories..IP .IP "\fB\-b, \-\-backup\fP"With this option, preexisting destination files arerenamed as each file is transferred or deleted.  You can control where thebackup file goes and what (if any) suffix gets appended using the\fB\-\-backup\-dir\fP and \fB\-\-suffix\fP options..IP Note that if you don't specify \fB\-\-backup\-dir\fP, (1) the\fB\-\-omit\-dir\-times\fP option will be implied, and (2) if \fB\-\-delete\fP isalso in effect (without \fB\-\-delete\-excluded\fP), rsync will add a \(lqprotect\(rqfilter-rule for the backup suffix to the end of all your existing excludes(e.g. \fB\-f "P *~"\fP).  This will prevent previously backed-up files from beingdeleted.  Note that if you are supplying your own filter rules, you mayneed to manually insert your own exclude/protect rule somewhere higher upin the list so that it has a high enough priority to be effective (e.g., ifyour rules specify a trailing inclusion/exclusion of \(oq*\(cq, the auto-addedrule would never be reached)..IP .IP "\fB\-\-backup\-dir=DIR\fP"In combination with the \fB\-\-backup\fP option, thistells rsync to store all backups in the specified directory on the receivingside.  This can be used for incremental backups.  You can additionallyspecify a backup suffix using the \fB\-\-suffix\fP option(otherwise the files backed up in the specified directorywill keep their original filenames)..IP .IP "\fB\-\-suffix=SUFFIX\fP"This option allows you to override the defaultbackup suffix used with the \fB\-\-backup\fP (\fB\-b\fP) option. The default suffix is a ~if no \-\fB\-backup-dir\fP was specified, otherwise it is an empty string..IP .IP "\fB\-u, \-\-update\fP"This forces rsync to skip any files which exist onthe destination and have a modified time that is newer than the sourcefile.  (If an existing destination file has a modification time equal to thesource file's, it will be updated if the sizes are different.).IP Note that this does not affect the copying of symlinks or other specialfiles.  Also, a difference of file format between the sender and receiveris always considered to be important enough for an update, no matter whatdate is on the objects.  In other words, if the source has a directorywhere the destination has a file, the transfer would occur regardless ofthe timestamps..IP .IP "\fB\-\-inplace\fP"This option changes how rsync transfers a file when thefile's data needs to be updated: instead of the default method of creatinga new copy of the file and moving it into place when it is complete, rsyncinstead writes the updated data directly to the destination file..IP 

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -