DEV Community

Lam
Lam

Posted on

2 2

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

Do your career a big favor. Join DEV. (The website you're on right now)

It takes one minute, it's free, and is worth it for your career.

Get started

Community matters

Top comments (0)

AWS Security LIVE!

Tune in for AWS Security LIVE!

Join AWS Security LIVE! for expert insights and actionable tips to protect your organization and keep security teams prepared.

Learn More

👋 Kindness is contagious

Engage with a sea of insights in this enlightening article, highly esteemed within the encouraging DEV Community. Programmers of every skill level are invited to participate and enrich our shared knowledge.

A simple "thank you" can uplift someone's spirits. Express your appreciation in the comments section!

On DEV, sharing knowledge smooths our journey and strengthens our community bonds. Found this useful? A brief thank you to the author can mean a lot.

Okay