Rsync flags and options reference
Complete reference table for Rsync command-line flags, options, and their defaults with working examples for file transfer and synchronization.
Complete reference for Rsync command-line flags and options.
Rsync General Output Options
Rsync provides flags to control the verbosity and format of transfer output.
| Flag | Description | Default | Example |
|---|---|---|---|
-v, --verbose | Verbose output: displays file names transferred and a summary at the end. Multiple
-v flags increase verbosity. | off | rsync -v src/ dest/ |
-q, --quiet | Suppresses non-error messages. Rsync produces no output except errors when this flag is set. Useful for cron jobs. | off | rsync -aq src/ dest/ |
-h, --human-readable | Displays file sizes in human-readable units (KB, MB, GB) instead of raw bytes. | off | rsync -avh src/ dest/ |
--progress | Shows a progress bar for each file during the transfer. Rsync displays bytes transferred, percentage complete, and transfer speed. | off | rsync -av --progress src/ dest/ |
--stats | Prints detailed file-transfer statistics at the end of the transfer, including total bytes sent, received, and the speedup ratio. | off | rsync -av --stats src/ dest/ |
--info=FLAGS | Fine-grained control over Rsync's informational output. Accepts comma-separated flags such as
progress2,
name, and
stats. | none | rsync -av --info=progress2 src/ dest/ |
--log-file=FILE | Writes Rsync's output to a log file at the specified path. | none | rsync -av --log-file=/var/log/rsync.log src/ dest/ |
Rsync Archive and Recursion Options
Rsync uses archive and recursion flags to control directory traversal and metadata preservation.
| Flag | Description | Default | Example |
|---|---|---|---|
-a, --archive | Archive mode: preserves file permissions, timestamps, symbolic links, group ownership, owner, and device files during transfer. Equivalent to
-rlptgoD. The recommended default for most transfers. | off | rsync -a src/ dest/ |
-r, --recursive | Recursively copies directories and their contents. Included in
-a. Does not preserve permissions, timestamps, or ownership on its own. | off | rsync -r src/ dest/ |
-l, --links | Copies symbolic links as symbolic links. Included in
-a. | off | rsync -rl src/ dest/ |
-p, --perms | Preserves file permissions on the destination. Included in
-a. | off | rsync -rp src/ dest/ |
-t, --times | Preserves modification times on the destination. Included in
-a. Rsync uses modification times to detect changed files. | off | rsync -rt src/ dest/ |
-g, --group | Preserves group ownership on the destination. Included in
-a. | off | rsync -rg src/ dest/ |
-o, --owner | Preserves file owner on the destination. Included in
-a. Requires root privileges on the destination. | off | rsync -ro src/ dest/ |
-D | Preserves device files and special files. Included in
-a. Equivalent to
--devices --specials. | off | rsync -rD src/ dest/ |
Rsync Transfer Behavior Options
Rsync flags that control how files are compared, compressed, and transferred.
| Flag | Description | Default | Example |
|---|---|---|---|
-z, --compress | Compresses file data during the transfer to reduce bandwidth usage. Rsync decompresses data at the destination. | off | rsync -avz src/ dest/ |
-n, --dry-run | Dry run: simulates the transfer and shows what Rsync would do without writing any files to disk. | off | rsync -avn src/ dest/ |
-P | Combines
--partial and
--progress. Keeps partially transferred files and shows a per-file progress bar. | off | rsync -avP src/ dest/ |
--partial | Keeps partially transferred files on the destination. Rsync resumes from the partial file on the next run instead of re-transferring from scratch. | off | rsync -av --partial src/ dest/ |
-u, --update | Skips files that are newer on the destination than on the source. Rsync compares modification times. | off | rsync -avu src/ dest/ |
-c, --checksum | Compares files by checksum (MD5 or xxHash) instead of modification time and file size. Slower but more accurate. | off | rsync -avc src/ dest/ |
-I, --ignore-times | Forces Rsync to transfer all files regardless of whether modification time and size match. Disables the quick-check optimization. | off | rsync -avI src/ dest/ |
--size-only | Skips files only when their sizes match, ignoring modification times. Useful when timestamps are unreliable, such as on FAT32 filesystems. | off | rsync -av --size-only src/ dest/ |
-W, --whole-file | Disables Rsync's delta-transfer algorithm and copies entire files. Faster for local transfers where disk I/O is faster than checksum computation. | auto | rsync -avW src/ dest/ |
--bwlimit=RATE | Limits the transfer bandwidth in kilobytes per second. Rsync throttles its transfer speed to stay below this limit. | unlimited | rsync -avz --bwlimit=1000 src/ dest/ |
--timeout=SECONDS | Sets Rsync's I/O timeout in seconds. Rsync exits if no data is transferred within this period. Set to
0 to disable. | 0 (none) | rsync -avz --timeout=300 src/ dest/ |
Rsync Remote Shell Options
Rsync flags for configuring the remote shell transport, including SSH.
| Flag | Description | Default | Example |
|---|---|---|---|
-e, --rsh=COMMAND | Specifies the remote shell program. Rsync uses SSH by default. Use this flag to pass SSH options such as a non-standard port. | ssh | rsync -avz -e "ssh -p 2222" src/ user@host:dest/ |
--rsync-path=PROGRAM | Specifies the path to the Rsync binary on the remote machine. Rsync uses this to run a command on the remote side before starting the transfer. | rsync | rsync -a --rsync-path="sudo rsync" src/ user@host:dest/ |
Rsync Delete and Backup Options
Rsync flags for mirroring directories and creating backups of overwritten files.
| Flag | Description | Default | Example |
|---|---|---|---|
--delete | Deletes files in the destination that do not exist in the source. Rsync creates an exact mirror of the source directory. | off | rsync -av --delete src/ dest/ |
--delete-after | Performs deletions after the transfer completes, not during. Safer than
--delete because files are available throughout the transfer. | off | rsync -av --delete-after src/ dest/ |
--remove-source-files | Deletes source files after Rsync transfers them. Effectively moves files instead of copying them. | off | rsync -av --remove-source-files src/ dest/ |
-b, --backup | Creates backup copies of files that Rsync overwrites at the destination. Backup files receive a tilde (
~) suffix by default. | off | rsync -avb src/ dest/ |
--backup-dir=DIR | Specifies the directory where Rsync stores backup copies of overwritten files. | none | rsync -avb --backup-dir=/backup/old src/ dest/ |
--suffix=SUFFIX | Sets the suffix appended to backup file names. Rsync uses
~ by default. | ~ | rsync -avb --suffix=.bak src/ dest/ |
Rsync Filter and Exclude Options
Rsync flags for including or excluding files and directories from the transfer.
| Flag | Description | Default | Example |
|---|---|---|---|
--exclude=PATTERN | Excludes files or directories matching the specified pattern from the transfer. Rsync accepts glob patterns. | none | rsync -av --exclude='*.log' src/ dest/ |
--include=PATTERN | Includes files matching the specified pattern. Rsync evaluates include rules before exclude rules. | none | rsync -av --include='*.conf' --exclude='*' src/ dest/ |
--exclude-from=FILE | Reads exclude patterns from a file, one pattern per line. | none | rsync -av --exclude-from=exclude.txt src/ dest/ |
-f, --filter=RULE | Adds a file-filtering rule. Rsync processes filter rules in order. | none | rsync -av -f '- *.tmp' src/ dest/ |
Rsync Permission and Timestamp Override Options
Rsync flags for overriding permission and timestamp handling, especially on non-Unix filesystems.
| Flag | Description | Default | Example |
|---|---|---|---|
--no-perms | Skips setting file permissions on the destination. Rsync applies the destination's default umask instead. Use this flag when syncing to FAT32 or NTFS filesystems that do not support Unix permissions. | off | rsync -av --no-perms src/ dest/ |
--no-owner | Skips setting file ownership on the destination. Alias:
--no-o. | off | rsync -av --no-o src/ dest/ |
--no-group | Skips setting group ownership on the destination. Alias:
--no-g. | off | rsync -av --no-g src/ dest/ |
-O, --omit-dir-times | Skips setting modification times on directories. Rsync still preserves file timestamps. Use this flag when the destination filesystem or user permissions do not allow setting directory timestamps. | off | rsync -aO src/ dest/ |
--chmod=CHMOD | Applies the specified permission changes to files on the destination. Rsync uses chmod syntax. | none | rsync -av --chmod=F644,D755 src/ dest/ |
--modify-window=NUM | Allows a timestamp comparison tolerance of NUM seconds. Rsync treats timestamps within this window as equal. Use
--modify-window=1 for FAT32 destinations that store timestamps with 2-second precision. | 0 | rsync -av --modify-window=1 src/ dest/ |
Rsync Advanced Options
Rsync flags for incremental backups, hard link preservation, and filesystem boundary control.
| Flag | Description | Default | Example |
|---|---|---|---|
--link-dest=DIR | Creates hard links to unchanged files in a reference directory instead of copying them. Rsync uses this for space-efficient incremental snapshot backups. | none | rsync -a --link-dest=/backup/prev src/ /backup/current |
-H, --hard-links | Preserves hard links between files during the transfer. | off | rsync -aH src/ dest/ |
-A, --acls | Preserves Access Control Lists (ACLs) on the destination. | off | rsync -aA src/ dest/ |
-X, --xattrs | Preserves extended attributes (xattrs) on the destination. | off | rsync -aX src/ dest/ |
--sparse | Handles sparse files efficiently by not allocating disk space for zero-filled sections. | off | rsync -av --sparse src/ dest/ |
-x, --one-file-system | Prevents Rsync from crossing filesystem boundaries. Rsync stays on the same mounted filesystem as the source. | off | rsync -avx src/ dest/ |
--numeric-ids | Transfers numeric user and group IDs instead of mapping them by name. Rsync avoids name-to-ID resolution on the destination. | off | rsync -av --numeric-ids src/ dest/ |
-i, --itemize-changes | Outputs a detailed change summary for each file using a coded string. Rsync shows which attributes changed (permissions, size, timestamp). | off | rsync -avi src/ dest/ |
--relative | Preserves the full source path on the destination. Rsync creates the same directory structure relative to the source root. | off | rsync -av --relative /home/user/./docs/ user@host:/backup/ |