rsync#
rsync 是一個開源公用程式,提供快速的增量檔案傳輸。rsync 依據 GNU 通用公共許可證(GNU General Public License)免費提供,目前由 Andrew Tridgell 維護。
Introduction#
Rsync 是一個快速且用途極其廣泛的檔案複製工具。它可以在本機複製,或透過任何遠端 Shell,對另一台主機進行複製(傳輸至或接收自),也可以對遠端 rsync 守護程序(daemon)進行複製。它提供了大量的選項來控制其行為的各個方面,並允許非常靈活地指定要複製的檔案集。它以其「差異傳輸演算法」(delta-transfer algorithm)而聞名,該演算法透過只傳送來源檔案與目的地現有檔案之間的差異,來減少網路傳輸的數據量。Rsync 被廣泛用於備份、鏡像(mirroring),以及作為日常使用的改良版複製命令。
Install#
$ sudo apt-get install rsyncOperate#
Usage: rsync [OPTION]... SRC [SRC]... DEST
or rsync [OPTION]... SRC [SRC]... [USER@]HOST:DEST
or rsync [OPTION]... SRC [SRC]... [USER@]HOST::DEST
or rsync [OPTION]... SRC [SRC]... rsync://[USER@]HOST[:PORT]/DEST
or rsync [OPTION]... [USER@]HOST:SRC [DEST]
or rsync [OPTION]... [USER@]HOST::SRC [DEST]
or rsync [OPTION]... rsync://[USER@]HOST[:PORT]/SRC [DEST]
The ':' usages connect via remote shell, while '::' & 'rsync://' usages connect
to an rsync daemon, and require SRC or DEST to start with a module name.| Option | 說明/用途 |
|---|---|
| –verbose, -v | increase verbosity |
| –archive, -a | archive mode is -rlptgoD (no -A,-X,-U,-N,-H) |
| –human-readable, -h | output numbers in a human-readable format |
| –compress, -z | compress file data during the transfer |
| –delete | delete extraneous files from dest dirs |
| –exclude=PATTERN | exclude files matching PATTERN |
| –include=PATTERN | don’t exclude files matching PATTERN |
| –bwlimit=RATE | limit socket I/O bandwidth |
| –rsh=COMMAND, -e | specify the remote shell to use |
| –progress | show progress during transfer |
Reference#
Official docs: