乐于分享
好东西不私藏

OpenClaw 常用命令速查指南

OpenClaw 常用命令速查指南

装好了 OpenClaw,怎么用?这篇把最常用的命令讲清楚,从入门到进阶。

写在前面

OpenClaw 的核心是 Gateway——一个长期运行的后台进程,负责接收消息、调用 AI、执行工具。大部分操作都通过终端命令行完成,但也提供了漂亮的 Web 控制台。

💡 所有命令在 openclaw --help 里都能看到完整列表,这篇挑最实用的讲。

一、启动与状态

启动 Gateway

这是 OpenClaw 的主进程,启动后一直在后台运行:

openclaw gateway         # 前台运行 openclaw gateway start   # 后台服务运行(推荐)openclaw gateway stop    # 停止服务openclaw gateway restart # 重启服务            

查看状态

openclaw status       # 整体运行状态        openclaw gateway status  # Gateway 详情 (bind、端口、连接) openclaw --version     # 查看版本号          openclaw doctor       # 诊断配置问题

二、配置管理

OpenClaw 的配置存在 ~/.openclaw/openclaw.json 里,通过命令行读写:

读写配置

openclaw config get gateway.bind  # 查看绑定模式 openclaw config get providers     # 查看 AI 模型配置openclaw config get channels      # 查看通信渠道配置openclaw config get cron          # 查看定时任务openclaw config get agents.default     # 查看默认 Agent 配置

写入配置 

openclaw config set gateway.bind lan               # 设为局域网可访问 openclaw config set gateway.auth.token "my-token"  # 设置认证令牌 openclaw config set providers.deepseek.apiKey "sk-xxx"  # 配模型 Key

其他操作 

openclaw config unset gateway.customBindHost  # 删除配置项 openclaw config get --all                    # 查看全部配置

常见误区gateway.bind 不填 IP 地址,而是填模式名:loopback(仅本机)、lan(0.0.0.0)、tailnetcustom(需配合 customBindHost)。

三、通信渠道

OpenClaw 支持接入多个聊天平台,配置好后在聊天软件里就能直接和 AI 对话。

QQ 机器人

openclaw config set channels.qqbot.enabled true openclaw config set channels.qqbot.appId "你的AppID" openclaw config set channels.qqbot.token "你的Token" openclaw gateway restart

配置后重启 Gateway,QQ 上就多了一个可以随时差遣的 AI 助手。

Telegram / Discord / Signal

类似的方式,配置对应的 channel 字段即可(channels.telegramchannels.discordchannels.signal)。

Web 控制台(零配置)

Gateway 启动后浏览器打开以下地址即可直接聊天:

http://localhost:18789/__openclaw__/

四、定时任务(Cron)

这是 OpenClaw 最有价值的功能之一——让 AI 在指定时间自动干活。

创建定时任务

openclaw cron add \   --name "Morning Brief" \   --cron "0 7 * * *" \   --tz "Asia/Shanghai" \   --session isolated \   --message "生成今日科技新闻简报" \   --announce \   --channel qqbot \   --to "user:你的QQ号"

参数说明:

  • –name:任务名称
  • –cron:cron 表达式(分 时 日 月 周)
  • –tz:时区
  • –session isolated:在独立 session 中执行(不影响主会话)
  • –message:告诉 AI 要干什么
  • –announce –channel qqbot –to “user:xxx”:结果推送到 QQ

管理定时任务

openclaw cron list                 # 列出所有任务openclaw cron show <job-id>        # 查看某任务详情openclaw cron runs --id <job-id>   # 查看运行历史openclaw cron remove <job-id>      # 删除任务

五、AI 模型配置

配置 DeepSeek(推荐,性价比最高)

openclaw config set agents.default.defaultSettings.modelProvider deepseek openclaw config set agents.default.defaultSettings.model deepseek/deepseek-chat openclaw config set providers.deepseek.apiKey "sk-你的Key"

配置 OpenAI

openclaw config set agents.default.defaultSettings.modelProvider openai openclaw config set agents.default.defaultSettings.model openai/gpt-4openclaw config set providers.openai.apiKey "sk-你的Key"

六、多设备联动(Node 模式)

把 Ubuntu 服务器、树莓派、旧手机当成 OpenClaw 的执行节点。

让另一台设备连接为主 Gateway 的 Node

主设备(macOS)

# 设置 Gateway 为 LAN 模式 openclaw config set gateway.bind lan openclaw config set gateway.auth.token "my-token" openclaw gateway restart

从设备(Ubuntu)

export OPENCLAW_GATEWAY_TOKEN="my-token" openclaw node run --host 192.168.1.16 --port 18789 --display-name "Ubuntu-Server"

家庭局域网也可加环境变量跳过安全警告:

export OPENCLAW_ALLOW_INSECURE_PRIVATE_WS=1 export OPENCLAW_GATEWAY_TOKEN="my-token" openclaw node run --host 192.168.1.16 --port 18789 --display-name "Ubuntu-Server"

查看和管理节点

openclaw nodes status        # 查看已连接节点openclaw devices list        # 查看已配对设备openclaw devices approve <ID>   # 批准配对请求

配置完成后,在 QQ 上说”去 Ubuntu 上看看磁盘”,AI 就会自动路由到 Ubuntu 执行命令。

七、安装与更新

安装

curl -fsSL https://openclaw.ai/install.sh | bash

更新

openclaw upgrade          # 升级到最新版openclaw upgrade check    # 检查是否有新版本

八、技能管理

技能(Skills)是 OpenClaw 的插件系统,可以从社区安装现成的,也可以自己写。

安装技能

clawhub search weather                # 搜索技能clawhub install weather               # 安装技能clawhub list                          # 查看已安装的技能clawhub update                        # 更新技能

九、快速参考速查表

场景
命令
启动服务
openclaw gateway start
查看状态
openclaw status
读配置
openclaw config get xxx
写配置
openclaw config set xxx yyy
加定时任务
openclaw cron add …
列定时任务
openclaw cron list
连节点设备
openclaw node run –host …
配 AI 模型
openclaw config set providers.*
诊断问题
openclaw doctor
升级版本
openclaw upgrade
安装技能
clawhub install xxx

写在最后

OpenClaw 的命令设计很清晰:分类 + 动作。所有命令都遵循 openclaw <类别> <动作> [参数] 的格式。

记不住也没关系,大部分时候你只需要跟它聊天,它在后台帮你执行。需要查命令时,openclaw --help 比搜索引擎快。

— END —