DEV Community

Lam
Lam

Posted on

Rsync Cheat Sheet

Archive options

-a, --archive    # archive (-rlptgoD)
Enter fullscreen mode Exit fullscreen mode
-r, --recursive
-l, --links      # copy symlinks as links
-p, --perms      # preserve permissions
-t, --times      # preserve times
-g, --group      # preserve group
-o, --owner      # preserve owner
-D               # same as --devices --specials
Enter fullscreen mode Exit fullscreen mode
--delete         # Delete extra files
Enter fullscreen mode Exit fullscreen mode

Include options

--exclude=PATTERN
--include=PATTERN
Enter fullscreen mode Exit fullscreen mode
--exclude-from=FILE
--include-from=FILE
--files-from=FILE    # read list of filenames from FILE
Enter fullscreen mode Exit fullscreen mode
-C, --cvs-exclude    # exclude from local/global .cvsignore
Enter fullscreen mode Exit fullscreen mode

Backup options

-b, --backup           # backup with suffix
    --suffix=SUFFIX    # default ~ without --backup-dir
    --backup-dir=DIR
Enter fullscreen mode Exit fullscreen mode

Skipping options

-u, --update     # skip files newer on dest
-c, --checksum   # skip based on checksum, not mod-time & size
Enter fullscreen mode Exit fullscreen mode

Display options

-q, --quiet
-v, --verbose
    --stats
-h, --human-readable
    --progress
-P                     # same as --partial --progress
Enter fullscreen mode Exit fullscreen mode

Transfer options

-z, --compress
-n, --dry-run
    --partial   # allows resuming of aborted syncs
    --bwlimit=RATE    # limit socket I/O bandwidth
Enter fullscreen mode Exit fullscreen mode

OSX

--exclude '.Trashes'
--exclude '.Spotlight-V100'
--exclude '.fseventsd'
Enter fullscreen mode Exit fullscreen mode

Basic example

# syncing folder src into dest:
rsync -avz ./src /dest
# syncing the content of src into dest:
rsync -avz ./src/ /dest
Enter fullscreen mode Exit fullscreen mode

Reference

Top comments (0)