rsync Backup Cheat Sheet
Cheat sheet for using rsync to create backups.
- Use
rsync -avh - Add
--progressfor file transfer progress - Add
--deleteto mirror backups - Use
--dry-runto preview changes
Core Command
Section titled “Core Command”rsync -avh --progress source/ destination/-a= archive mode (recursive, preserves permissions, timestamps, symlinks, etc)-v= verbose output-h= human-readable sizes--progress= shows file transfer progress
Mirror Backup
Section titled “Mirror Backup”rsync -avh --delete source/ destination/--delete= removes files in destination that no longer exist in source
Dry Run
Section titled “Dry Run”rsync -avh --dry-run source/ destination/Note On Trailing Slashes
Section titled “Note On Trailing Slashes”rsync -avh source/ destination/ # copies the _contents_ of sourcersync -avh source destination/ # copies the _source folder itself_