Skip to main content

rsync Command Builder

By Dejan Panovski Updated on

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.

Options

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

    OptionMeaning
    -aArchive mode: recurse and preserve symlinks, permissions, timestamps, group, owner, and devices
    -vVerbose: list each transferred file
    -zCompress data during transfer, useful on slow links
    -hHuman readable sizes (K, M, G)
    -uSkip files that are newer on the destination
    -PShow progress and keep partial files so transfers can resume
    -nDry run: show what would happen without changing anything
    –deleteRemove destination files that no longer exist on the source
    –exclude=PATTERNSkip files and directories matching the pattern
    –bwlimit=KBPSCap 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:

    1. Run the command with -n first and review the deleting ... lines.
    2. 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 .