rsync Cheatsheet - File Sync

All essential rsync commands organized by use case, with 31+ entries you can copy and run directly. Find the right command fast when you need it.

SysOps·31 commands·Last updated 2026-07-19
Back to SysOps

Basic Sync 4

rsync -avz ./src /dest
Sync src Directory到 dest(含 src 本身)
rsync -avz ./src/ /dest
Sync src 内容到 dest(不含 src 本身)
rsync -avz user@host:/remote /local
从远程拉取到本地
rsync -avz /local user@host:/remote
推送本地到远程

Transfer Options 5

-z, --compress
传输时Compress数据
-n, --dry-run
模拟Execute,不实际传输
--partial
保留部分传输的File(supports断点续传)
--bwlimit=1M
限制带宽为 1MB/s
-e ssh
指定使用 SSH 作为传输channel

Display Options 6

-v, --verbose
verboseOutput
-q, --quiet
silent模式
--stats
Display传输统计信息
-h, --human-readable
人class可读的数字格式
--progress
Display传输进度
-P
同 --partial --progress

Skip & Filter 5

-u, --update
Jump过目标端Update的File
-c, --checksum
基于校验和Jump过(而非时间+size)
--exclude=.git
排除 .git Directory
--exclude-from=.rsyncignore
从FileRead排除规则
--include=*.txt
package含特定File

Backup Options 4

-b, --backup
backupoverwrite的File
--suffix=.bak
backupFile后缀
--backup-dir=/backup
backup到指定Directory
--delete
Delete目标端多余File(镜像Sync)

Archive Mode 7

-a, --archive
归档模式(-rlptgoD)
-r, --recursive
recursively处理Directory
-l, --links
保留符号链接
-p, --perms
保留Permission
-t, --times
保留时间戳
-g, --group
保留User组
-o, --owner
保留所有者

💡 Tips

  • src/ 和 src 的区别:带斜杠Sync内容,不带SyncDirectory本身。
  • -a 是 -rlptgoD 的alias,保留几乎所有Fileproperty。
  • --delete 会Delete目标端多余File,首次使用建议加 -n 模拟。
  • rsync 基于增量传输,只传差异部分,效率高。
  • 远程传输默认用 SSH,可用 -e 指定其他命令或Options。

Official References

Commands are compiled from the official docs below. Click to verify the latest usage.

Maintained by LaoHand

Publicly updated on Jul 19, 2026, continuously proofread against official docs.

Found an error? Report it

Wrong command or description? Open an issue to help us fix it.

Found an error? Report it