Skip to content

#ภาคผนวก A: เอกสารโกงคำสั่ง

OpenClaw มีเครื่องมือบรรทัดคำสั่งมากมาย ภาคผนวกนี้จัดระเบียบคำสั่งที่ใช้กันทั่วไปทั้งหมดตามเอกสารอย่างเป็นทางการ

แหล่งอ้างอิง: OpenClaw CLI Reference

การนำทางด่วน


ตัวเลือกระดับโลก

bash
openclaw [--dev] [--profile <name>] <command>

--dev              # 隔离状态到 ~/.openclaw-dev,并偏移默认端口
--profile <name>   # 隔离状态到 ~/.openclaw-<name>
--no-color         # 禁用 ANSI 颜色
--update           # 简写为 openclaw update(仅源码安装)
-V, --version, -v  # 打印版本并退出

การติดตั้งและการอัพเดต

ติดตั้ง OpenClaw

bash
# 通过 npm 安装(推荐)
npm install -g openclaw@latest

# 或通过 pnpm
pnpm add -g openclaw@latest

อัปเดต OpenClaw

bash
# 检查并更新到最新版本
openclaw update

# 切换到特定频道
openclaw update --channel stable|beta|dev

# 查看当前版本
openclaw --version

ถอนการติดตั้ง OpenClaw

bash
# 卸载网关服务和本地数据(CLI 保留)
openclaw uninstall

# 指定范围卸载
openclaw uninstall --service --state --workspace --app --all

# 重置配置和状态(保留 CLI)
openclaw reset
openclaw reset --scope config+creds+sessions --yes

การเริ่มต้นและการกำหนดค่า

ตัวช่วยสร้างการเริ่มต้น

bash
# 交互式设置向导(推荐)
openclaw onboard

# 初始化并安装守护进程
openclaw onboard --install-daemon

# 非交互式模式
openclaw onboard --non-interactive --mode local

# 重置后重新初始化
openclaw onboard --reset

วิซาร์ดการกำหนดค่า

bash
# 交互式配置向导
openclaw configure

# 验证配置
openclaw doctor
openclaw doctor --fix          # 自动修复
openclaw doctor --deep         # 深度扫描

เปิดคอนโซล

bash
# 启动 Web Dashboard
openclaw dashboard

การจัดการเกตเวย์

Gateway เป็นบริการหลักของ OpenClaw และทำงานที่ ws://127.0.0.1:18789 ตามค่าเริ่มต้น

เริ่มเกตเวย์

bash
# 前台运行(调试模式)
openclaw gateway --port 18789 --verbose

# 指定绑定地址
openclaw gateway --bind loopback|lan|tailnet|auto|custom

# 使用 Token 认证
openclaw gateway --auth token --token <token>

# 使用密码认证
openclaw gateway --auth password --password <password>

# Tailscale 集成
openclaw gateway --tailscale serve|funnel

# 开发模式
openclaw gateway --dev

การจัดการบริการเกตเวย์

bash
# 查看网关服务状态
openclaw gateway status

# 安装为系统服务
openclaw gateway install

# 卸载服务
openclaw gateway uninstall

# 启动/停止/重启服务
openclaw gateway start
openclaw gateway stop
openclaw gateway restart

# 查看日志
openclaw logs
openclaw logs --limit 100

ตรวจสุขภาพเกตเวย์

bash
# 获取网关健康状态
openclaw health
openclaw health --json
openclaw health --verbose

# 网关调用(RPC)
openclaw gateway call <method> --params '<json>'

การจัดการตัวแทน

รายชื่อตัวแทนทั้งหมด

bash
openclaw agents list
openclaw agents list --json
openclaw agents list --bindings

เพิ่มตัวแทน

bash
# 交互式添加
openclaw agents add

# 指定名称添加
openclaw agents add [name]

# 非交互式添加
openclaw agents add my-agent \
  --workspace ~/.openclaw/workspace-my-agent \
  --model anthropic/claude-sonnet-4-5 \
  --bind whatsapp:personal \
  --non-interactive

การจัดการการผูกมัด

bash
# 查看绑定
openclaw agents bindings
openclaw agents bindings --agent <id>

# 添加绑定
openclaw agents bind --agent <id> --bind <channel[:accountId]>

# 移除绑定
openclaw agents unbind --agent <id> --bind <channel[:accountId]>
openclaw agents unbind --agent <id> --all

ลบตัวแทน

bash
openclaw agents delete <id>
openclaw agents delete <id> --force

เรียกใช้ตัวแทน

bash
# 单次对话
openclaw agent --message "Hello" --to <dest>

# 指定会话
openclaw agent --message "Hello" --session-id <id>

# 指定思考级别
openclaw agent --message "Hello" --thinking high

# 本地模式(不通过网关)
openclaw agent --message "Hello" --local

# 指定渠道回复
openclaw agent --message "Hello" --channel whatsapp --deliver

การจัดการทักษะ

รายการทักษะ

bash
openclaw skills list
openclaw skills list --eligible    # 仅显示就绪技能
openclaw skills list --json
openclaw skills list -v            # 显示缺失需求详情

ดูรายละเอียดทักษะ

bash
openclaw skills info <name>

ตรวจสอบสถานะทักษะ

bash
openclaw skills check

เคล็ดลับ: ใช้ npx clawhub เพื่อค้นหา ติดตั้ง และซิงค์ทักษะ


การจัดการปลั๊กอิน

รายการปลั๊กอิน

bash
openclaw plugins list
openclaw plugins list --json

ดูรายละเอียดปลั๊กอิน

bash
openclaw plugins info <id>

ติดตั้งปลั๊กอิน

bash
openclaw plugins install <path|.tgz|npm-spec>

เปิด/ปิดการใช้งานปลั๊กอิน

bash
openclaw plugins enable <id>
openclaw plugins disable <id>

การวินิจฉัยปลั๊กอิน

bash
openclaw plugins doctor

การจัดการหน่วยความจำ

ดูสถานะหน่วยความจำ

bash
openclaw memory status

ดัชนีหน่วยความจำ

bash
openclaw memory index

ค้นหาหน่วยความจำ

bash
openclaw memory search "<query>"
openclaw memory search --query "<query>"

การจัดการอุปกรณ์

แสดงรายการอุปกรณ์

bash
openclaw devices list
openclaw devices list --json

อุปกรณ์อนุมัติ

bash
openclaw devices approve [requestId]
openclaw devices approve --latest

ปฏิเสธอุปกรณ์

bash
openclaw devices reject <requestId>

ถอดอุปกรณ์ออก

bash
openclaw devices remove <deviceId>

ล้างเครื่อง

bash
openclaw devices clear --yes
openclaw devices clear --yes --pending

การจัดการการจับคู่

รายการคำขอจับคู่

bash
openclaw pairing list
openclaw pairing list [channel] --channel <channel> --account <id>

อนุมัติการจับคู่

bash
openclaw pairing approve <channel> <code>
openclaw pairing approve --channel <channel> <code> --notify

การจัดการช่องทาง

รายการช่อง

bash
openclaw channels list
openclaw channels list --json

ตรวจสอบสถานะช่อง

bash
openclaw channels status
openclaw channels status --probe

ดูบันทึกช่อง

bash
openclaw channels logs
openclaw channels logs --channel <name> --limit 200

เพิ่มช่อง

bash
# 交互式添加
openclaw channels add

# 非交互式添加 Telegram
openclaw channels add \
  --channel telegram \
  --account alerts \
  --name "Alerts Bot" \
  --token $TELEGRAM_BOT_TOKEN

# 非交互式添加 Discord
openclaw channels add \
  --channel discord \
  --account work \
  --name "Work Bot" \
  --token $DISCORD_BOT_TOKEN

ลบช่อง

bash
openclaw channels remove --channel <channel> --account <id>
openclaw channels remove --channel <channel> --account <id> --delete

เข้าสู่ระบบ/ออกจากระบบ

bash
# WhatsApp Web 登录
openclaw channels login
openclaw channels login --channel whatsapp --account <id> --verbose

# 登出
openclaw channels logout
openclaw channels logout --channel <channel> --account <id>

การส่งข้อความ

ส่งข้อความ

bash
openclaw message send --target +15555550123 --message "Hello"

ส่งโหวตครับ

bash
openclaw message poll \
  --channel discord \
  --target channel:123 \
  --poll-question "Snack?" \
  --poll-option Pizza \
  --poll-option Sushi

การดำเนินการข้อความอื่น ๆ

bash
openclaw message react
openclaw message reactions
openclaw message read
openclaw message edit
openclaw message delete
openclaw message pin
openclaw message unpin

การจัดการโมเดล

รายการรุ่น

bash
openclaw models list
openclaw models status

ตั้งค่าโมเดล

bash
openclaw models set <model>
openclaw models set-image <model>

นามแฝงรุ่น

bash
openclaw models aliases list
openclaw models aliases add <alias> <model>
openclaw models aliases remove <alias>

การย้อนกลับโมเดล

bash
openclaw models fallbacks list
openclaw models fallbacks add <model>
openclaw models fallbacks remove <model>
openclaw models fallbacks clear

การรับรองรุ่น

bash
openclaw models auth add
openclaw models auth setup-token
openclaw models auth paste-token
openclaw models auth order get|set|clear

การดำเนินการกำหนดค่า

รับการกำหนดค่า

bash
openclaw config get <path>
openclaw config get agents.defaults.workspace

ตั้งค่าการกำหนดค่า

bash
openclaw config set <path> <value>
openclaw config set agents.defaults.heartbeat.every "2h"

ลบการกำหนดค่า

bash
openclaw config unset <path>

เส้นทางไฟล์การกำหนดค่า

bash
openclaw config file

ตรวจสอบการกำหนดค่า

bash
openclaw config validate
openclaw config validate --json

การจัดการระบบ

เหตุการณ์ของระบบ

bash
openclaw system event

การจัดการการเต้นของหัวใจ

bash
openclaw system heartbeat last
openclaw system heartbeat enable
openclaw system heartbeat disable

สถานะออนไลน์

bash
openclaw system presence

การจัดการความปลอดภัย

การตรวจสอบความปลอดภัย

bash
openclaw security audit
openclaw security audit --deep
openclaw security audit --fix

การจัดการคีย์

bash
openclaw secrets reload
openclaw secrets audit
openclaw secrets configure
openclaw secrets apply --from <plan.json>

การจัดการเซสชัน

เซสชันรายการ

bash
openclaw sessions list
openclaw sessions --json
openclaw sessions --verbose

ตรวจสอบสถานะ

bash
openclaw status
openclaw status --json
openclaw status --deep
openclaw status --usage

การจัดการเบราว์เซอร์

bash
openclaw browser status
openclaw browser start
openclaw browser stop
openclaw browser reset-profile
openclaw browser tabs
openclaw browser open <url>
openclaw browser screenshot
openclaw browser navigate <url>

งานที่กำหนดเวลาไว้

bash
openclaw cron status
openclaw cron list
openclaw cron add
openclaw cron edit <id>
openclaw cron rm <id>
openclaw cron enable <id>
openclaw cron disable <id>
openclaw cron runs
openclaw cron run <id>

นามแฝงคำสั่งทางลัด

เพื่อปรับปรุงประสิทธิภาพ คุณสามารถตั้งค่านามแฝงสำหรับคำสั่งที่ใช้กันทั่วไปได้:

bash
# 添加到 ~/.bashrc 或 ~/.zshrc
alias oc='openclaw'
alias ocg='openclaw gateway'
alias ocs='openclaw skills'
alias oca='openclaw agents'
alias ocd='openclaw dashboard'
alias ocdr='openclaw doctor'
alias occh='openclaw channels'

# 快速启动别名
alias ocstart='openclaw gateway start && openclaw dashboard'
alias ocstop='openclaw gateway stop'
alias ocrestart='openclaw gateway restart'

การแก้ไขปัญหาการตรวจสอบอย่างรวดเร็ว

ปัญหาคำสั่งวินิจฉัยโซลูชั่น
ไม่สามารถเริ่มเกตเวย์ได้openclaw doctorตรวจสอบการเข้าใช้พอร์ตและดูบันทึก
ไม่สามารถเข้าถึงแดชบอร์ดได้openclaw gateway statusยืนยันว่าเกตเวย์กำลังทำงานอยู่และตรวจสอบไฟร์วอลล์
การเชื่อมต่อช่องล้มเหลวopenclaw channels status --probeตรวจสอบการกำหนดค่าช่องและการรับรองความถูกต้อง
การเชื่อมต่อโมเดลล้มเหลวopenclaw models statusตรวจสอบคีย์ API และการกำหนดค่าโมเดล
การจับคู่อุปกรณ์ล้มเหลวopenclaw devices listอนุมัติอุปกรณ์ที่รอดำเนินการ
การตรวจสอบการกำหนดค่าล้มเหลวopenclaw config validateซ่อมแซมการกำหนดค่าตามข้อความแจ้งข้อผิดพลาด

ความช่วยเหลือเพิ่มเติม

bash
# 查看全局帮助
openclaw --help

# 查看子命令帮助
openclaw <command> --help

# 查看具体命令帮助
openclaw gateway --help
openclaw channels add --help

เคล็ดลับ: เอกสารสรุปนี้อ้างอิงจากเอกสาร OpenClaw อย่างเป็นทางการ ขอแนะนำให้ไปที่ docs.openclaw.ai เพื่อดูข้อมูลล่าสุด