rsync is a fast, versatile file-copying tool that uses a delta-transfer algorithm to send only the differences between source and destination files. It supports local copies, remote transfers over SSH, and a standalone daemon mode. rsync is widely used for backups, website mirroring, and directory synchronization because it minimizes data transfer, preserves file attributes, and offers fine-grained control over what is synced and deleted.
What This Cheat Sheet Covers
This topic spans 15 focused tables and 116 indexed concepts. Below is a complete table-by-table outline of this topic, spanning foundational concepts through advanced details.
Basic Syntax and Local CopiesArchive Mode and Attribute PreservationRemote Transfers Over SSHMirroring and Deletion StrategiesInclude, Exclude, and Filter RulesIncremental Backups with --link-destFile Comparison ModesBandwidth Limiting and Partial Transfersrsync Daemon Mode (rsyncd)Logging and MonitoringAutomation with Cron and SystemdExit Codes and Error HandlingCommon Use Casesrsync vs Alternative ToolsAdvanced Options and Gotchas
Basic Syntax and Local Copies
| Technique/Command | Example | Description |
|---|---|---|
rsync source_file dest_file | Copy a single file locally; rsync checks size and mtime and only transfers if changed | |
rsync -r /src/dir/ /dst/dir/ | Recursively copy directory contents; trailing slash on source copies contents not the directory itself | |
rsync -r /src/dir /dst/dir/ | Omitting trailing slash on source copies the directory itself into the destination | |
rsync -v source dest | Print names of files being transferred | |
rsync -n source dest | Show what would be transferred without making changes; combine with -v for detail |