UNIX rsync
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
Option | Alternative | Short-name | Description |
---|---|---|---|
-a | --archive | Archive | archive mode; equals -rlptgoD (no -H,-A,-X) |
-h | --human-readable | Human readable | output number in a human readable format |
-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 |
-v | --verbose | Verbose | increase verbosity |
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 - |