← 返回博客

OpenClaw 入门命令速查(CLI Quickstart)

面向已经在服务器或本地装好 OpenClaw 的用户,只记住这些命令,就能 80% 覆盖日常使用场景。
日常运维 模型与渠道 安全与诊断 适合贴给同事

0. 查看整体状态

第一反应:有问题先看它。确认 Gateway / 模型 / 通道是否在线。
openclaw status          # 总览:模型、渠道、gateway、版本
openclaw status --deep   # 带更多细节,适合排查故障

1. Gateway 服务管理

Gateway 是 OpenClaw 的“心脏”。绝大多数问题,先检查它是否在跑。
openclaw gateway status   # 看当前运行状态
openclaw gateway start    # 启动 gateway
openclaw gateway stop     # 停止 gateway
openclaw gateway restart  # 重启(改配置后常用)

2. 模型与 API Key

确认主模型连得上、fallback 正常。API Key 改了也从这里入手。

2.1 模型连通性

openclaw models status        # 列出当前模型配置
openclaw models status --probe # 实际打一次请求测试连通性

2.2 快速调整主模型 / Fallback

示例:把主模型设为 Codex,把 fallback 清空再只留 minimax。
openclaw models set-default openai-codex/gpt-5.1
openclaw models fallbacks clear
openclaw models fallbacks add minimax/MiniMax-M2.5

2.3 更新 / 重设 API Key

推荐用交互式配置,避免命令行里直接暴露 key。
openclaw configure --section openai   # 重设 OpenAI / Codex Key
openclaw configure --section web      # 配置 Brave Search Key

3. 渠道(Telegram / Feishu 等)管理

让 OpenClaw 进 Telegram / 飞书等聊天工具的入口。

3.1 查看 / 探测通道

openclaw channels list           # 当前配置了哪些通道
openclaw channels status --probe # 对所有通道做一次连通性测试

3.2 新增一个通道(示例:Telegram)

openclaw channels add \
  --channel telegram \
  --token "YOUR_TELEGRAM_BOT_TOKEN"

3.3 从 CLI 发一条测试消息

有 Telegram 用户名时最方便:
openclaw message send \
  --channel telegram \
  --target @your_username \
  --message "OpenClaw Telegram 通道测试 ✅"

4. 常用诊断命令

感觉“哪里怪怪的”的时候,用这些命令排查。

4.1 OpenClaw 自检

openclaw health --json        # 机器可读的健康检查
openclaw status --all         # 带更多信息的状态汇总

4.2 安全审计(只查不改)

openclaw security audit       # 快速安全检查
openclaw security audit --deep # 更全面(端口、权限等)

4.3 查看日志(按最近时间)

openclaw logs tail            # 跟踪近期 gateway 日志
openclaw logs tail --errors   # 只看错误日志

5. 版本与更新

确认当前版本、是否有新版本。
openclaw update status   # 查看当前版本 & 是否有可用更新
openclaw version         # 打印 OpenClaw 版本

6. Skills(技能)相关

知道有哪些技能可用、出问题时先看说明。
openclaw skills list                 # 列出已安装的技能
openclaw skills info <name>         # 查看某个技能的详细信息
openclaw skills open <name>         # 打开技能目录(看 SKILL.md)

7. 定时任务(cron)简要

让 OpenClaw 定时做事(比如每天推送日报)。

7.1 查看已有任务

openclaw cron list

7.2 添加一个简单任务示例

例:每天 09:00 运行一个脚本。
openclaw cron add \
  --name daily-report \
  --schedule "0 9 * * *" \
  --command "bash /root/.openclaw/workspace/scripts/daily-report.sh"

8. 最常用的 10 条命令(可以直接记住这块)

openclaw status
openclaw gateway status
openclaw gateway restart
openclaw models status --probe
openclaw channels status --probe
openclaw message send --channel telegram --target @your_username --message "test"
openclaw security audit
openclaw logs tail --errors
openclaw update status
openclaw skills list

9. 适合给同事的“一句话说明”