附錄 A:命令速查表
OpenClaw 提供了豐富的命令行工具,本附錄基於官方文檔整理所有常用命令。
快速導航
全局選項
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>'Agent 管理
列出所有 Agent
bash
openclaw agents list
openclaw agents list --json
openclaw agents list --bindings添加 Agent
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刪除 Agent
bash
openclaw agents delete <id>
openclaw agents delete <id> --force運行 Agent
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 | 檢查端口占用,查看日誌 |
| Dashboard 無法訪問 | 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 獲取最新信息。