| Command | Description |
| Core flags |
| -a (--archive) | Recursive + preserve perms, times, symlinks, owner, group |
| -z (--compress) | Compress data in transit |
| -v (--verbose) | Show files being transferred |
| -P | --partial + --progress (resume + show progress) |
| -n (--dry-run) | Simulate — no changes written |
| --delete | Delete files on dst not present on src |
| --checksum | Compare by checksum, not mtime/size |
| --bwlimit=5000 | Limit bandwidth (KBytes/s) |
| Local → Remote (SSH) |
| rsync -avz /src/ user@host:/dst/ | Sync directory to remote (trailing / = contents only) |
| rsync -avzP /src/ user@host:/dst/ | With progress & resume support |
| rsync -avz --delete /src/ user@host:/dst/ | Mirror — removes files deleted on src |
| rsync -avz -e "ssh -p 2222" /src/ user@host:/dst/ | Non-default SSH port |
| rsync -avz -e "ssh -i /root/.ssh/id_rsa" /src/ user@host:/dst/ | Custom identity file |
| Remote → Local |
| rsync -avz user@host:/src/ /local/dst/ | Pull remote directory locally |
| rsync -avzP user@host:/src/big.tar /local/ | Pull single file with resume |
| Local → Local |
| rsync -av /mnt/data/ /mnt/backup/ | Local disk sync |
| Filtering |
| rsync -av --exclude='*.log' /src/ user@host:/dst/ | Exclude by pattern |
| rsync -av --exclude-from=/tmp/excl.txt /src/ user@host:/dst/ | Exclude list from file |
| rsync -av --include='*.tar.gz' --exclude='*' /src/ user@host:/dst/ | Include only .tar.gz files |
| Backup / AIX considerations |
| rsync -avz --numeric-ids /src/ user@host:/dst/ | Preserve UID/GID numerically (cross-host) |
| rsync -avz --log-file=/var/log/rsync.log /src/ user@host:/dst/ | Write transfer log |
| rsync -avzn /src/ user@host:/dst/ 2>&1 | tee /tmp/dryrun.out | Dry-run with captured output for review |
Trailing slash on source matters: /src/ syncs contents into /dst/; /src (no slash) creates /dst/src/. On AIX, ensure rsync is installed via toolbox/rpm and SSH key auth is in place for scripted jobs.