rsync is a utility software and network protocol for Unix-like systems (with ports to Microsoft Windows and Apple Macintosh) that synchronizes files and directories from one location to another while minimizing data transfer by using delta encoding when appropriate. Quoting the official website: "rsync is a file transfer program for Unix systems. rsync uses the 'rsync algorithm' which provides a very fast method for bringing remote files into sync." A feature of rsync not found in most similar programs/protocols is that the mirroring takes place with only one transmission in each direction, eliminating the message latency overhead inherent in transmitting a large number of small messages. rsync can copy or display directory contents and copy files, optionally using compression and recursion.
- rsync [option] ... srr [src] ... [user@]host:dest
- Local: rsync [OPTION...] SRC... [DEST]
- Access via remote shell:
- Pull: rsync [OPTION...] [USER@]HOST:SRC... [DEST]
- Push: rsync [OPTION...] SRC... [USER@]HOST:DEST
- Access via rsync daemon:
- rsync [OPTION...] [USER@]HOST::SRC... [DEST]
- rsync [OPTION...] rsync://[USER@]HOST[:PORT]/SRC... [DEST]
- rsync [OPTION...] SRC... [USER@]HOST::DEST
- rsync [OPTION...] SRC... rsync://[USER@]HOST[:PORT]/DEST
See for a complete list the man pages.
|-a||--archive||Archive||archive mode; equals -rlptgoD (no -H,-A,-X)|
|-C||--cvs-include||VCS ignore||excluding a broad range of files that you often don't want to transfer between systems. It uses a similar algorithm to CVS to determine if a file should be ignored. |
Ignored files: .nse_depinfo *~ #* .#* ,* _$* *$ *.old *.bak *.BAK *.orig *.rej .del-* *.a *.olb *.o *.obj *.so *.exe *.Z *.elc *.ln core .svn/ .git/ .bzr/
|-c||--checksum||Checksum||skip based on checksum, not mod-time & size|
|-D||--devices||Devices & Specials||same as --devices and --specials|
|-f --exclude=PATTERN||--filter||Filter||Exclude the pattern-files from the synchronisation.|
|-h||--human-readable||Human readable||output number in a human readable format|
|-i||--itemize-changes||Itemize||output a change summary for all updates. |
See Option itemize
|-n||--dry-run||Dry run||Performs a trial run with no changes mode|
|-q||--quiet||Quiet||Suppress non-error messages|
|-r||--recursive||Recursive||recurse into directories|
|-t||--times||Times||preserves modification times|
The option -i (itemize) gives a list of filename with attributes.
The first character indicates what is happening to the file:
- < means that a file is being transferred to the remote host (sent).
- > means that a file is being transferred to the local host (received).
- c means that a local change/creation is occurring for the item (such as the creation of a directory or the changing of a symlink, etc.).
- h means that the item is a hard link to another item (requires --hard-links).
- . means that the item is not being updated (though it might have attributes that are being modified).
- * means that the rest of the itemized-output area contains a message (e.g. "deleting").
The second character indicates what type of directory entry it is. Specifically:
- f for file
- d for directory
- L for symbolic link
- D for device
- S for special file (e.g. socket or fifo)
The remaining columns are described below:
- c means either that a regular file has a different checksum or that a symlink, device, or special file has a changed value.
- s means the size of a regular file is different and will be updated by the file transfer.
- t or T:
- t Bold text means the modification time is different and is being updated to the sender's value
- T means that the modification time will be set to the transfer time
- p means the permissions are different and are being updated to the sender's value
- o means the owner is different and is being updated to the sender's value
- g means the group is different and is being updated to the sender's value
- . unused
The following columns may not be present, depending on your transfer options
- a means that the ACL information changed
- x means that the extended attribute information changed
|rsync -avh /home/usr/dir/ /media/disk/backup||Copies the home directory to your external disk backup using a human readable format|
|rsync -achrv xx yy||Copies xx to yy if archive, checksum (not time and size), human readable, recursive and verbose.|
|rsync -Ccghipron /App...Top2000/ /Dat...Top2000/||Copies only file differ on checksum (dry run modus). Output look like: |
- Linux, Man-pages, rsync.