Created
January 2, 2026 17:59
-
-
Save phoenixthrush/286f7a4065f8e91d5c8c31edc7dd5c4c to your computer and use it in GitHub Desktop.
Rsync Cheat Sheet: Common Variations with Examples #Rsync #CheatSheet
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/env bash | |
| # Basic recursive copy with verbose output and human-readable sizes | |
| rsync -avh --progress --stats src/ dst/ | |
| # Mirror a directory (delete extraneous files in destination) | |
| rsync -avh --delete src/ dst/ | |
| # Copy only updated or new files (skip existing identical files) | |
| rsync -avhu src/ dst/ | |
| # Exclude specific files or directories (e.g., temp or logs) | |
| rsync -avh --exclude 'temp/' --exclude '*.log' src/ dst/ | |
| # Compress files during transfer for faster network sync | |
| rsync -avhz src/ user@remote:/path/to/destination/ | |
| # Show what would be transferred without actually copying | |
| rsync -avhn src/ dst/ | |
| # Sync directories preserving permissions, times, symbolic links, and hard links | |
| rsync -aHAX src/ dst/ | |
| # Limit bandwidth to 1MB/s (useful over slow networks) | |
| rsync -avh --bwlimit=1024 src/ dst/ | |
| # Sync over SSH with a specific port | |
| rsync -avh -e "ssh -p 2222" src/ user@remote:/path/to/destination/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment