Basic rsync syntax
rsync source/ destination/
Note: Trailing slash matters!
source/copies contents of sourcesourcecopies the directory itself
Sync with progress
rsync -avh --progress source/ destination/
-a: Archive mode (preserves permissions, timestamps)-v: Verbose-h: Human-readable sizes
Sync over SSH
rsync -avz source/ user@remote:/path/to/destination/
-z: Compress during transfer
Dry run (preview without changes)
rsync -avhn --delete source/ destination/
-n: Dry run--delete: Remove files in destination not in source
Exclude files/directories
rsync -av --exclude='node_modules' --exclude='*.log' source/ destination/
Resume interrupted transfer
rsync -avP source/ destination/
-P: Same as--partial --progress
Sync only specific file types
rsync -av --include='*.jpg' --exclude='*' source/ destination/
Bandwidth limit (1000 KB/s)
rsync -av --bwlimit=1000 source/ destination/
Show what would be deleted
rsync -avn --delete source/ destination/ | grep deleting