UNIX rsync: Difference between revisions

From HaFrWiki42
Jump to navigation Jump to search
Line 43: Line 43:
| -h || --human-readable || Human readable || output number in a human readable format
| -h || --human-readable || Human readable || output number in a human readable format
|-
|-
| -i  || --itemize-changes || Itemize || output a change summary for all updates  
| -i  || --itemize-changes || Itemize || output a change summary for all updates. <br>See [[#Option Itemize|Option itemize]]
|-
|-
| -n || --dry-run || Dry run || Performs a trial run with no changes mode
| -n || --dry-run || Dry run || Performs a trial run with no changes mode

Revision as of 13:48, 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/
-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

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

top

Reference

top