rsync copies files efficiently by transferring only differences. It's the best tool for backups, deployments, and keeping directories in sync.
February 25, 2026 · 5 min · 928 words · Rob Washington
Table of Contents
rsync synchronizes files between locations — local to local, local to remote, remote to local. It’s smart: it only transfers what’s changed, making it fast for incremental backups and deployments.
-a, --archive Archive mode (preserves permissions, timestamps, etc.)-v, --verbose Verbose output
-n, --dry-run Show what would be transferred
-z, --compress Compress during transfer
-P Progress + partial (resume interrupted transfers)--progress Show progress
--delete Delete files in dest not in source-r, --recursive Recurse into directories
-h, --human-readable Human-readable sizes
# Delete files in dest not in sourcersync -av --delete /source/ /dest/
# Delete before transfer (frees space first)rsync -av --delete-before /source/ /dest/
# Delete after transferrsync -av --delete-after /source/ /dest/
# Delete excluded files from destrsync -av --delete-excluded --exclude='*.log' /source/ /dest/
rsync is the backbone of backups and deployments. Learn the archive flag (-a), understand the trailing slash behavior, and always dry-run (-n) destructive operations first. Once you’re comfortable, you’ll use it for everything from syncing config files to mirroring terabytes.
📬 Get the Newsletter
Weekly insights on DevOps, automation, and CLI mastery. No spam, unsubscribe anytime.