UNIX rsync: Difference between revisions

From HaFrWiki42
Jump to navigation Jump to search
Line 57: Line 57:
| Copies the home directory to your external disk backup using a human readable format  
| Copies the home directory to your external disk backup using a human readable format  
|-
|-
| rsync -
| rsync -achrv xx yy
| Copies xx to yy if archive, checksum (not time and size), human readable, recursive and verbose.
|}
|}



Revision as of 12:42, 3 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


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/
-c --checksum Checksum skip based on checksum, not mod-time & size
-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 -achrv xx yy Copies xx to yy if archive, checksum (not time and size), human readable, recursive and verbose.

See also

top

Reference

top