rsync Command Builder
Check the options you need and watch the rsync command update live, with a plain English explanation of every flag. The builder also warns you about the classic rsync traps, such as the trailing slash and --delete.
Comma separated
KiB per second
Command
What each option does
The trailing slash rule
The single most common rsync mistake is the trailing slash on the source path. The destination is not affected by this rule; only the source is.
rsync -a /var/www/ /backup/copies the contents of/var/www/into/backup/, so you get/backup/index.html.rsync -a /var/www /backup/copies the directory itself, so you get/backup/www/index.html.
The builder shows which behavior your current source path produces. When in doubt, add -n (dry run) and read the file list before running the real transfer.
Common rsync options
| Option | Meaning |
|---|---|
| -a | Archive mode: recurse and preserve symlinks, permissions, timestamps, group, owner, and devices |
| -v | Verbose: list each transferred file |
| -z | Compress data during transfer, useful on slow links |
| -h | Human readable sizes (K, M, G) |
| -u | Skip files that are newer on the destination |
| -P | Show progress and keep partial files so transfers can resume |
| -n | Dry run: show what would happen without changing anything |
| –delete | Remove destination files that no longer exist on the source |
| –exclude=PATTERN | Skip files and directories matching the pattern |
| –bwlimit=KBPS | Cap bandwidth in KiB/s |
| -e ‘ssh -p PORT’ | Use SSH on a non-default port |
Almost every real transfer starts with -a. It is a shorthand for -rlptgoD and keeps the copy faithful to the source. For the full option reference and more examples, see the rsync command guide
.
Safe mirroring with –delete
--delete removes unexcluded destination files that no longer exist on the source. Files matched by an exclude pattern stay in place, and -u can keep destination files that are newer than their source copies. It is also easy to lose data when the source path is wrong or unexpectedly empty. Two habits keep it safe:
- Run the command with
-nfirst and review thedeleting ...lines. - Point the transfer at a dedicated destination directory, never at a directory that also holds other data.
The builder shows a warning whenever --delete is enabled without a dry run.
Remote transfers
rsync runs over SSH when either path uses the user@host:/path form. A remote transfer only moves the differences between the two sides, which is why it beats scp for repeated copies. If the server listens on a non-default port, set the SSH port field and the builder adds -e 'ssh -p PORT' for you. Step-by-step remote examples are in transferring files with rsync over SSH
.
For recurring backups, combine the generated command with --link-dest to keep space-efficient snapshots, as described in incremental backups with rsync
.