UNIX rsync: Difference between revisions
m Hjmf moved page Unix rsync to UNIX rsync: The name Unix is not the right name for UNIX. |
|
(No difference)
|
Revision as of 10:42, 4 December 2013
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."[3] A feature of rsync not found in most similar programs/protocols[citation needed] 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.[4] rsync can copy or display directory contents and copy files, optionally using compression and recursion.
Synopsis
Basic:
- rsync [option] ... srr [src] ... [user@]host:dest
Complete:
- 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:
- 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
- Pull:
Options
See for a complete list the man pages.
Option | Alternative | Short-name | Description |
---|---|---|---|
-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/ |
-D | --devices | Devices & Specials | same as --devices and --specials |
-c | --checksum | Checksum | skip based on checksum, not mod-time & size |
-g | --group | Group | preserve group |
-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 |
-o | --owner | Owner | preserves owner |
-q | --quiet | Quiet | Suppress non-error messages |
-r | --recursive | Recursive | recurse into directories |
-t | --times | Times | preserves modification times |
-v | --verbose | Verbose | increase verbosity |
Option itemize
The option -i (itemize) gives a list of filename with attributes.
Char 1
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").
Char 2
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)
Next characters
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
Examples
Command example | Description |
---|---|
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: >fcsT....... Top2000.php |
See also
- Linux, Man-pages, rsync.