rsync 用法

rsync [OPTIO­N]... SRC [SRC]... DEST

rsync [OPTIO­N]... SRC [SRC]... [USER@­]HO­ST:DEST

rsync [OPTIO­N]... SRC [SRC]... [USER@­]HO­ST:­:DEST

rsync [OPTIO­N]... SRC [SRC]... rsync:­//[­USE­R@]­HOS­T[:­POR­T]/DEST

rsync [OPTIO­N]... [USER@­]HO­ST:SRC [DEST]

rsync [OPTIO­N]... [USER@­]HO­ST::SRC [DEST]

rsync [OPTIO­N]... rsync:­//[­USE­R@]­HOS­T[:­POR­T]/SRC [DEST]

rsync 选项

--verbose, -v

increase verbosity

--quiet, -q

suppress non-error messages


suppress daemon­-mode MOTD (see manpage caveat)

--chec­ksum, -c

skip based on checksum, not mod-time & size

--archive, -a

archive mode; equals -rlptgoD (no -H,-A,-X)


turn off an implied OPTION (e.g. --no-D)

--recu­rsive, -r

recurse into direct­ories

--rela­tive, -R

use relative path names


don't send implied dirs with --relative

--backup, -b

make backups (see --suffix & --back­up-dir)


make backups into hierarchy based in DIR


set backup suffix (default ~ w/o --back­up-dir)

--update, -u

skip files that are newer on the receiver


update destin­ation files in-place (SEE MAN PAGE


append data onto shorter files


like --append, but with old data in file checksum

--dirs, -d

transfer direct­ories without recursing

--links, -l

copy symlinks as symlinks

--copy­-links, -L

transform symlink into referent file/dir


only "­uns­afe­" symlinks are transf­ormed


ignore symlinks that point outside the source tree

--copy­-di­rlinks, -k

transform symlink to a dir into referent dir

--keep­-di­rlinks, -K

treat symlinked dir on receiver as dir

--hard­-links, -H

preserve hard links

--perms, -p

preserve permis­sions

--exec­uta­bility, -E

preserve the file's execut­ability


affect file and/or directory permis­sions

--acls, -A

preserve ACLs (implies --perms)

--xattrs, -X

preserve extended attributes

--owner, -o

preserve owner (super­-user only)

--group, -g

preserve group


preserve device files (super­-user only)


preserve special files


same as --devices --special

--times, -t

preserve modifi­cation times

--omit­-di­r-t­imes, -O

omit direct­ories from --times


receiver attempts super-user activities


store/­recover privileged attrs using xattrs

rsync Options contd.

--sparse, -S
handle sparse files effici­ently
--dry-run, -n
perform a trial run with no changes made
--whol­e-file, -W
copy files whole (without delta-xfer algorithm)
--one-­fil­e-s­ystem, -x
don't cross filesystem boundaries
force a fixed checksum block-size
--rsh=­COM­MAND, -e
specify the remote shell to use
specify the rsync to run on the remote machine
skip creating new files on receiver
skip updating files that already exist on receiver
sender removes synchr­onized files (non-dirs)
an alias for --dele­te-­during
delete extraneous files from destin­ation dirs
receiver deletes before transfer, not during
receiver deletes during transfer (default)
find deletions during, delete after
receiver deletes after transfer, not during
also delete excluded files from destin­ation dirs
delete even if there are I/O errors
force deletion of direct­ories even if not empty
don't delete more than NUM files
don't transfer any file larger than SIZE
don't transfer any file smaller than SIZE
keep partially transf­erred files
put a partially transf­erred file into DIR
put all updated files into place at transfer's end
--prun­e-e­mpt­y-dirs, -m
prune empty directory chains from the file-list
don't map uid/gid values by user/group name
set I/O timeout in seconds
set daemon connection timeout in seconds
--igno­re-­times, -I
don't skip files that match in size and mod-time
skip files that match in size
compare mod-times with reduced accuracy
--temp­-dir, -T
create temporary files in directory DIR
--fuzzy, -y
find similar file for basis if no dest file
also compare destin­ation files relative to DIR
... and include copies of unchanged files
hardlink to files in DIR when unchanged
--comp­ress, -z
compress file data during the transfer

rsync Options cont'd.


explicitly set compre­ssion level


skip compre­ssing files with a suffix in LIST

--cvs-­exc­lude, -C

auto-i­gnore files the same way CVS does

--filt­er=­RULE, -f

add a file-f­ilt­ering RULE


same as --filt­er=­'di­r-merge /.rsyn­c-f­ilter'


repeated: --filt­er='- .rsync­-fi­lter'


exclude files matching PATTERN


read exclude patterns from FILE


don't exclude files matching PATTERN


read include patterns from FILE


read list of source­-file names from FILE

--from0, -0

all *-from­/filter files are delimited by 0s

--prot­ect­-args, -s

no space-­spl­itting; only wildcard specia­l-chars


bind address for outgoing socket to daemon


specify double­-colon alternate port number


specify custom TCP options


use blocking I/O for the remote shell


give some file-t­ransfer stats

--8-bi­t-o­utput, -8

leave high-bit chars unescaped in output

--huma­n-r­eadble, -h

output numbers in a human-­rea­dable format


show progress during transfer


same as --partial --progress

--item­ize­-ch­anges, -i

output a change­-su­mmary for all updates


output a change­-su­mmary for all updates


log what we're doing to the specified FILE


log updates using the specified FMT


read daemon­-access password from FILE


list the files instead of copying them


limit I/O bandwidth; KBytes per second


write a batched update to FILE


like --writ­e-batch but w/o updating destin­ation


read a batched update from FILE


force an older protocol version to be used


request charset conversion of filenames

--ipv4, -4

prefer IPv4

--ipv6, -6

prefer IPv6


print version number

--help, -h

show this help ( -h works with no other options )