System
rsync
rsync commands for efficient file synchronization.
27 commands
Windows
MacOS
Linux
#file-sync
#backup
Basic Sync
Sync directory with archive mode and verbose
rsync -av source/ dest/
Copy a single file preserving attributes
rsync -av file.txt dest/
Show transfer progress
rsync -av --progress source/ dest/
Dry run, preview changes without copying
rsync -avn source/ dest/
Sync and remove extra files in dest
rsync -av --delete source/ dest/
Remote Sync
Sync local to remote over SSH
rsync -av source/ user@host:/path/
Sync remote to local over SSH
rsync -av user@host:/path/ dest/
Sync over custom SSH port
rsync -av -e "ssh -p 2222" source/ user@host:/path/
Compress data during transfer
rsync -avz source/ user@host:/path/
Resume interrupted transfers
rsync -av --partial --progress source/ user@host:/path/
Include/Exclude
Exclude log files
rsync -av --exclude="*.log" source/ dest/
Exclude patterns from file
rsync -av --exclude-from="exclude.txt" source/ dest/
Include only jpg files
rsync -av --include="*.jpg" --exclude="*" source/ dest/
Exclude multiple patterns
rsync -av --exclude=".git" --exclude="node_modules" src/ dest/
Advanced Options
Skip files larger than 100 MB
rsync -av --max-size=100m source/ dest/
Skip files smaller than 1 KB
rsync -av --min-size=1k source/ dest/
Limit bandwidth to 5000 KB per sec
rsync -av --bwlimit=5000 source/ dest/
Use checksum instead of time and size
rsync -av --checksum source/ dest/
Skip files that are newer on dest
rsync -av --update source/ dest/
Skip files that already exist on dest
rsync -av --ignore-existing source/ dest/
Backup Strategies
Keep backups of changed files
rsync -av --backup --suffix=.bak source/ dest/
Store backups in separate directory
rsync -av --backup-dir=/backups source/ dest/
Incremental backup with hard links
rsync -av --link-dest=../prev-backup source/ new-backup/
Mirror sync excluding snapshots
rsync -av --delete --exclude=".snapshot" source/ dest/
Quick Commands
Sync directories with archive mode and verbose output
rsync -av source/ dest/
Sync to a remote host with compression over SSH
rsync -avz source/ user@host:/path/
Dry run to preview changes without copying
rsync -avn source/ dest/