rsync is a fast, versatile file synchronization and transfer tool. It only sends the differences between files (delta transfer), making it highly efficient for backups and mirrors.
rsync [options] source destination
| /local/path/ | Local path. Trailing slash = copy contents; no trailing slash = copy directory itself. |
| user@host:/path/ | Remote path via SSH (default). Host can be a hostname or IP. |
| rsync://host/module/ | Native rsync daemon protocol (port 873). Faster than SSH for large syncs. |
| ::module/path | Shorthand for rsync daemon on localhost. |
| -a / --archive | Archive mode: equivalent to -rlptgoD. Preserves almost everything. Start here for most backups. |
| -v / --verbose | Show files being transferred. Use -vv for more detail. |
| -n / --dry-run | Simulate without transferring. Always test with -n first, especially with --delete. |
| -z / --compress | Compress data during transfer. Good for slow links; overhead on fast local networks. |
| -P | Shorthand for --partial --progress. Keep partial files + show per-file progress. |
| --delete | Delete files in dest that don't exist in source. Makes dest a mirror. Use with -n first! |
| -e ssh | Use SSH as transport. Default for remote. Add options: -e "ssh -p 2222 -i key.pem". |
rsync -a /src/ /dst/ — copies the contents of /src into /dst
rsync -a /src /dst/ — copies the directory /src into /dst (creates /dst/src/)
| Basic backup | rsync -av --delete /home/user/ /backup/user/ |
| Remote backup | rsync -avz --delete /home/ user@server:/backup/home/ |
| Resume interrupted | rsync -avP /large/file.iso user@server:/dest/ |
| Mirror (exact copy) | rsync -av --delete --checksum /src/ /dst/ |
| Dry run first | rsync -avn --delete /src/ /dst/ |
| Exclude patterns | rsync -av --exclude='*.tmp' --exclude='.git/' /src/ /dst/ |
| Bandwidth limit | rsync -av --bwlimit=5000 /src/ user@host:/dst/ |
| Custom SSH port | rsync -av -e "ssh -p 2222" /src/ user@host:/dst/ |
• Always test destructive operations (--delete, --remove-source-files) with -n first.
• --stats at the end gives a useful transfer summary.
• For very large syncs, add --info=progress2 for an overall progress indicator instead of per-file.
• --link-dest enables efficient incremental backups with hard links.
• Use --filter or --exclude-from for complex exclusion rules from a file.
This is an educational tool. The commands it builds are real — they will do exactly what you tell them to. Some flags are destructive (deletion, overwriting, forced operations) and even non-destructive options can cause data loss or system trouble in the wrong circumstances.
• Always review the generated command before running it.
• Test on disposable files and directories first.
• If you do not understand what a flag does, look it up in the official manual page (man command).
The author of these pages is not responsible for any damage, data loss, or other consequences resulting from commands generated, copied, or run from this site. Use at your own risk.
⚠ These tools build real shell commands. Review every command before running it. The author is not responsible for any damage, data loss, or other consequences resulting from commands generated, copied, or run from this site. Use at your own risk.
Send comments and bug reports to chris@chrisspackman.com.
Version 0.3.0 — Last updated: 2026-05-26
This page is Copyright © 2026
Chris Spackman <chris@chrisspackman.com>.
This web site developed entirely on GNU/Linux with Free / Open Source Software.
This work is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License.