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

📄 rsync.yo

📁 Rsync 3.0.5 source code
💻 YO
📖 第 1 页 / 共 5 页
字号:
mailto(rsync-bugs@samba.org)manpage(rsync)(1)(28 Dec 2008)()()manpagename(rsync)(a fast, versatile, remote (and local) file-copying tool)manpagesynopsis()verb(Local:  rsync [OPTION...] SRC... [DEST]Access via remote shell:  Pull: rsync [OPTION...] [USER@]HOST:SRC... [DEST]  Push: rsync [OPTION...] SRC... [USER@]HOST:DESTAccess via rsync daemon:  Pull: rsync [OPTION...] [USER@]HOST::SRC... [DEST]        rsync [OPTION...] rsync://[USER@]HOST[:PORT]/SRC... [DEST]  Push: rsync [OPTION...] SRC... [USER@]HOST::DEST        rsync [OPTION...] SRC... rsync://[USER@]HOST[:PORT]/DEST)Usages with just one SRC arg and no DEST arg will list the source filesinstead of copying.manpagedescription()Rsync is a fast and extraordinarily versatile file copying tool.  It cancopy locally, to/from another host over any remote shell, or to/from aremote rsync daemon.  It offers a large number of options that controlevery aspect of its behavior and permit very flexible specification of theset of files to be copied.  It is famous for its delta-transfer algorithm,which reduces the amount of data sent over the network by sending only thedifferences between the source files and the existing files in thedestination.  Rsync is widely used for backups and mirroring and as animproved copy command for everyday use.Rsync finds files that need to be transferred using a "quick check"algorithm (by default) that looks for files that have changed in size orin last-modified time.  Any changes in the other preserved attributes (asrequested by options) are made on the destination file directly when thequick check indicates that the file's data does not need to be updated.Some of the additional features of rsync are:itemization(  it() support for copying links, devices, owners, groups, and permissions  it() exclude and exclude-from options similar to GNU tar  it() a CVS exclude mode for ignoring the same files that CVS would ignore  it() can use any transparent remote shell, including ssh or rsh  it() does not require super-user privileges  it() pipelining of file transfers to minimize latency costs  it() support for anonymous or authenticated rsync daemons (ideal for       mirroring))manpagesection(GENERAL)Rsync copies files either to or from a remote host, or locally on thecurrent host (it does not support copying files between two remote hosts).There are two different ways for rsync to contact a remote system: using aremote-shell program as the transport (such as ssh or rsh) or contacting anrsync daemon directly via TCP.  The remote-shell transport is used wheneverthe source or destination path contains a single colon (:) separator aftera host specification.  Contacting an rsync daemon directly happens when thesource or destination path contains a double colon (::) separator after ahost specification, OR when an rsync:// URL is specified (see also the"USING RSYNC-DAEMON FEATURES VIA A REMOTE-SHELL CONNECTION" section foran exception to this latter rule).As a special case, if a single source arg is specified without adestination, the files are listed in an output format similar to "ls -l".As expected, if neither the source or destination path specify a remotehost, the copy occurs locally (see also the bf(--list-only) option).Rsync refers to the local side as the "client" and the remote side as the"server".  Don't confuse "server" with an rsync daemon -- a daemon is always aserver, but a server can be either a daemon or a remote-shell spawned process.manpagesection(SETUP)See the file README for installation instructions.Once installed, you can use rsync to any machine that you can access viaa remote shell (as well as some that you can access using the rsyncdaemon-mode protocol).  For remote transfers, a modern rsync uses sshfor its communications, but it may have been configured to use adifferent remote shell by default, such as rsh or remsh.You can also specify any remote shell you like, either by using the bf(-e)command line option, or by setting the RSYNC_RSH environment variable.Note that rsync must be installed on both the source and destinationmachines.manpagesection(USAGE)You use rsync in the same way you use rcp. You must specify a sourceand a destination, one of which may be remote.Perhaps the best way to explain the syntax is with some examples:quote(tt(rsync -t *.c foo:src/))This would transfer all files matching the pattern *.c from thecurrent directory to the directory src on the machine foo. If any ofthe files already exist on the remote system then the rsyncremote-update protocol is used to update the file by sending only thedifferences. See the tech report for details.quote(tt(rsync -avz foo:src/bar /data/tmp))This would recursively transfer all files from the directory src/bar on themachine foo into the /data/tmp/bar directory on the local machine. Thefiles are transferred in "archive" mode, which ensures that symboliclinks, devices, attributes, permissions, ownerships, etc. are preservedin the transfer.  Additionally, compression will be used to reduce thesize of data portions of the transfer.quote(tt(rsync -avz foo:src/bar/ /data/tmp))A trailing slash on the source changes this behavior to avoid creating anadditional directory level at the destination.  You can think of a trailing/ on a source as meaning "copy the contents of this directory" as opposedto "copy the directory by name", but in both cases the attributes of thecontaining directory are transferred to the containing directory on thedestination.  In other words, each of the following commands copies thefiles in the same way, including their setting of the attributes of/dest/foo:quote(tt(rsync -av /src/foo /dest)nl()tt(rsync -av /src/foo/ /dest/foo)nl())Note also that host and module references don't require a trailing slash tocopy the contents of the default directory.  For example, both of thesecopy the remote directory's contents into "/dest":quote(tt(rsync -av host: /dest)nl()tt(rsync -av host::module /dest)nl())You can also use rsync in local-only mode, where both the source anddestination don't have a ':' in the name. In this case it behaves likean improved copy command.Finally, you can list all the (listable) modules available from aparticular rsync daemon by leaving off the module name:quote(tt(rsync somehost.mydomain.com::))See the following section for more details.manpagesection(ADVANCED USAGE)The syntax for requesting multiple files from a remote host is done byspecifying additional remote-host args in the same style as the first,or with the hostname omitted.  For instance, all these work:quote(tt(rsync -av host:file1 :file2 host:file{3,4} /dest/)nl()tt(rsync -av host::modname/file{1,2} host::modname/file3 /dest/)nl()tt(rsync -av host::modname/file1 ::modname/file{3,4}))Older versions of rsync required using quoted spaces in the SRC, like theseexamples:quote(tt(rsync -av host:'dir1/file1 dir2/file2' /dest)nl()tt(rsync host::'modname/dir1/file1 modname/dir2/file2' /dest))This word-splitting still works (by default) in the latest rsync, but isnot as easy to use as the first method.If you need to transfer a filename that contains whitespace, you can eitherspecify the bf(--protect-args) (bf(-s)) option, or you'll need to escapethe whitespace in a way that the remote shell will understand.  Forinstance:quote(tt(rsync -av host:'file\ name\ with\ spaces' /dest))manpagesection(CONNECTING TO AN RSYNC DAEMON)It is also possible to use rsync without a remote shell as the transport.In this case you will directly connect to a remote rsync daemon, typicallyusing TCP port 873.  (This obviously requires the daemon to be running onthe remote system, so refer to the STARTING AN RSYNC DAEMON TO ACCEPTCONNECTIONS section below for information on that.)Using rsync in this way is the same as using it with a remote shell exceptthat:itemization(	it() you either use a double colon :: instead of a single colon to	separate the hostname from the path, or you use an rsync:// URL.	it() the first word of the "path" is actually a module name.	it() the remote daemon may print a message of the day when you	connect.	it() if you specify no path name on the remote daemon then the	list of accessible paths on the daemon will be shown.	it() if you specify no local destination then a listing of the	specified files on the remote daemon is provided.	it() you must not specify the bf(--rsh) (bf(-e)) option.)An example that copies all the files in a remote module named "src":verb(    rsync -av host::src /dest)Some modules on the remote daemon may require authentication. If so,you will receive a password prompt when you connect. You can avoid thepassword prompt by setting the environment variable RSYNC_PASSWORD tothe password you want to use or using the bf(--password-file) option. Thismay be useful when scripting rsync.WARNING: On some systems environment variables are visible to allusers. On those systems using bf(--password-file) is recommended.You may establish the connection via a web proxy by setting theenvironment variable RSYNC_PROXY to a hostname:port pair pointing toyour web proxy.  Note that your web proxy's configuration must supportproxy connections to port 873.You may also establish a daemon connection using a program as a proxy bysetting the environment variable RSYNC_CONNECT_PROG to the commands youwish to run in place of making a direct socket connection.  The string maycontain the escape "%H" to represent the hostname specified in the rsynccommand (so use "%%" if you need a single "%" in your string).  Forexample:verb(  export RSYNC_CONNECT_PROG='ssh proxyhost nc %H 873'  rsync -av targethost1::module/src/ /dest/  rsync -av rsync:://targethost2/module/src/ /dest/ )The command specified above uses ssh to run nc (netcat) on a proxyhost,which forwards all data to port 873 (the rsync daemon) on the targethost(%H).manpagesection(USING RSYNC-DAEMON FEATURES VIA A REMOTE-SHELL CONNECTION)It is sometimes useful to use various features of an rsync daemon (such asnamed modules) without actually allowing any new socket connections into asystem (other than what is already required to allow remote-shell access).Rsync supports connecting to a host using a remote shell and then spawninga single-use "daemon" server that expects to read its config file in thehome dir of the remote user.  This can be useful if you want to encrypt adaemon-style transfer's data, but since the daemon is started up fresh bythe remote user, you may not be able to use features such as chroot orchange the uid used by the daemon.  (For another way to encrypt a daemontransfer, consider using ssh to tunnel a local port to a remote machine andconfigure a normal rsync daemon on that remote host to only allowconnections from "localhost".)From the user's perspective, a daemon transfer via a remote-shellconnection uses nearly the same command-line syntax as a normalrsync-daemon transfer, with the only exception being that you must

⌨️ 快捷键说明

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