rsync

rsync is a skill for Claude Code, Codex from chaterm/terminal-skills. It costs 10 tokens per session (1,114 once invoked), scanned C, original, Apache-2.0.

Guidance for using rsync, a command-line tool that copies and synchronizes files between folders or computers. It includes local transfers, remote transfers, exclusions, progress reporting, and backups.

In plain words
What is it for?
Use it to synchronize folders, send or retrieve files over SSH, mirror directories, exclude files, limit transfer speed, or create incremental backups.
Why use it?
It helps avoid manually copying changed files and provides repeatable commands for transfers and backups. Dry runs can show what would change before copying.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one.

Good fit Use it to synchronize folders, send or retrieve files over SSH, mirror directories, exclude files, limit transfer speed, or create incremental backups.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/chaterm/terminal-skills/rsync
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add chaterm/terminal-skills --skill rsync
Clone the repo
git clone --depth 1 https://github.com/chaterm/terminal-skills

Made for: Claude Code, Codex.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for rsync

README.md
[![agentmods](https://agentmods.dev/badge/skills/chaterm/terminal-skills/rsync.svg)](https://agentmods.dev/skills/chaterm/terminal-skills/rsync)
Your own site
<a href="https://agentmods.dev/skills/chaterm/terminal-skills/rsync"><img src="https://agentmods.dev/badge/skills/chaterm/terminal-skills/rsync.svg" alt="Measured on agentmods" height="20"></a>
Per session 10 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,114 The whole file, excluding the scripts and references it only reads on demand.
Security scan C 1 finding. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00010 $0.01114
Opus 5 $0.00005 $0.00557
Sonnet 5 $0.00002 $0.00223
Haiku 4.5 $0.00001 $0.00111

Measured 8d ago against content hash 4136c5a25054, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-08, from the pricing page.

Security

Grade C, and why

rsync scanned grade C with 1 finding against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 8d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Recursive force deletehighDestructive command

rm -rf with a variable or a broad path is one typo away from removing the wrong tree.

find "$DEST" -maxdepth 1 -type d -mtime +7 -exec rm -rf {} \;
backup/rsync/SKILL.md · 156 lines

How it starts

The opening of the file, as written. The whole thing — 156 lines — stays where its author put it; the contents beside it link to each section on GitHub.

rsync 文件同步与备份

概述

rsync 是强大的文件同步工具,支持增量传输、远程同步、备份等场景。

基础用法

# 本地同步
rsync -av source/ dest/

# 远程同步(推送)
rsync -av source/ user@remote:/path/dest/

# 远程同步(拉取)
rsync -av user@remote:/path/source/ dest/

# 常用参数
# -a  归档模式(保留权限、时间等)
# -v  详细输出
# -z  压缩传输
# -P  显示进度 + 断点续传
# -n  模拟运行(dry-run)

常用参数组合

# 标准备份
rsync -avz source/ dest/

# 带进度显示
rsync -avzP source/ dest/

# 删除目标多余文件(镜像同步)
rsync -avz --delete source/ dest/

# 排除文件
rsync -avz --exclude='*.log' --exclude='.git' source/ dest/

# 使用排除文件
rsync -avz --exclude-from='exclude.txt' source/ dest/

# 限制带宽(KB/s)
rsync -avz --bwlimit=1000 source/ dest/

远程同步

# 通过 SSH(默认)
rsync -avz -e ssh source/ user@host:/path/

# 指定 SSH 端口
rsync -avz -e 'ssh -p 2222' source/ user@host:/path/

# 使用 SSH 密钥
rsync -avz -e 'ssh -i ~/.ssh/key' source/ user@host:/path/

# rsync daemon 模式
rsync -avz source/ rsync://user@host/module/

备份策略

增量备份

# 使用硬链接实现增量备份
rsync -avz --link-dest=/backup/latest source/ /backup/$(date +%Y%m%d)/

# 更新 latest 链接
ln -snf /backup/$(date +%Y%m%d) /backup/latest

定时备份脚本

#!/bin/bash
set -euo pipefail

SOURCE="/data/"
DEST="/backup/"
DATE=$(date +%Y%m%d_%H%M%S)
LATEST="$DEST/latest"
BACKUP="$DEST/$DATE"

# 增量备份
rsync -avz --delete --link-dest="$LATEST" "$SOURCE" "$BACKUP"

# 更新 latest 链接
ln -snf "$BACKUP" "$LATEST"

# 保留最近 7 天
find "$DEST" -maxdepth 1 -type d -mtime +7 -exec rm -rf {} \;

常见场景

场景 1:网站文件同步

# 同步网站文件,排除缓存和日志
rsync -avz --delete \
  --exclude='cache/' \
  --exclude='*.log' \
  --exclude='uploads/tmp/' \
  /var/www/html/ backup@remote:/backup/www/

场景 2:数据库备份同步

# 先导出数据库
mysqldump -u root -p database > /backup/db.sql

# 同步到远程
rsync -avzP /backup/db.sql backup@remote:/backup/mysql/

场景 3:断点续传大文件

# 使用 -P 参数支持断点续传
rsync -avzP large_file.tar.gz user@remote:/path/

# 如果中断,重新执行相同命令即可继续

故障排查

问题 解决方法
权限错误 检查目标目录权限,使用 --chmod
连接超时 检查网络、SSH 配置、防火墙
空间不足 清理目标磁盘,使用 --max-size 限制
同步慢 使用 -z 压缩,--bwlimit 限速
文件被跳过 检查 --exclude 规则,使用 -v 查看详情

Read the full file on GitHub · 156 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 8d ago First seen · 156 lines · 10 tokens per session scan C 4136c5a25054

Subscribe to this mod's changes

rsync is a skill published in the GitHub repository chaterm/terminal-skills (58 stars, last pushed 6mo ago), licensed Apache-2.0. It adds 10 tokens to every session and 1,114 once invoked, about $0.0001 per session on Opus 5. A static security scan graded it C with 1 finding (recursive force delete). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.