Fast, resumable file synchronization tool — local or over SSH.
medium risk
rsync transfers only changed file blocks (delta transfer) making it extremely efficient. -a preserves permissions, timestamps, symlinks, and ownership. --delete mirrors the source exactly. Always test with -n (dry-run) first.
| Flag | Meaning |
|---|---|
-a --archive | Archive: recursive + preserve perms, times, symlinks, owner |
-v --verbose | Show transferred files |
-z --compress | Compress data during transfer |
--progress | Show per-file progress during transfer |
--delete | Delete destination files not in source (mirror mode) |
--exclude | Exclude files matching a pattern |
-n --dry-run | Simulate without actually transferring |
rsync -avz --progress /var/www/ user@host:/var/www/Sync web root to remote server with progress display · explain & risk-check →rsync -av --delete --exclude='.git' /project/ /backup/Mirror project directory excluding .git · explain & risk-check →rsync -avn /src/ /dst/Dry-run to preview what would sync before committing · explain & risk-check →Always test with `rsync -avn` (dry run) before using `--delete`. One typo in the source path could wipe your entire destination.
Reference text is hand-written and may be incomplete — check man rsync for your version. Test destructive commands on a non-production system first.