菇太帷i Lv4

openclaw的一些常用命令汇总

快速入门

初始化与配置

命令说明
openclaw setup初始化配置和工作空间
openclaw configure交互式配置向导(模型、频道、技能、网关)
openclaw onboard完整入门向导(网关 + 工作空间 + 技能)
openclaw doctor健康检查 + 自动修复配置问题
openclaw status查看会话状态、频道健康、最近联系人
openclaw dashboard打开 Control UI 控制面板

setup 选项

1
2
3
4
5
6
7
openclaw setup --workspace <目录>     # 指定工作空间路径
openclaw setup --wizard # 运行配置向导
openclaw setup --non-interactive # 非交互模式
openclaw setup --mode local|remote # 本地或远程模式
openclaw setup --remote-url <URL> # 远程网关地址
openclaw setup --remote-token <令牌> # 远程网关令牌

onboard 选项

1
2
3
4
5
6
openclaw onboard --reset              # 重置后运行向导
openclaw onboard --flow quickstart # 快速开始模式
openclaw onboard --flow advanced # 高级模式
openclaw onboard --gateway-port 18789 # 指定网关端口
openclaw onboard --install-daemon # 安装为系统服务


Gateway 网关服务

基本命令

命令说明
openclaw gateway启动 WebSocket 网关(前台运行)
openclaw gateway status查看网关状态(默认探测 RPC)
openclaw gateway start启动网关服务(后台)
openclaw gateway stop停止网关服务
openclaw gateway restart重启网关服务
openclaw gateway install安装为系统服务
openclaw gateway uninstall卸载系统服务

启动参数

1
2
3
4
5
6
7
8
9
10
openclaw gateway --port 18789              # 指定端口
openclaw gateway --bind lan # 绑定地址:loopback|lan|tailnet|auto|custom
openclaw gateway --token <令牌> # 认证令牌
openclaw gateway --auth token|password # 认证方式
openclaw gateway --password <密码> # 密码认证
openclaw gateway --force # 强制终止占用端口的进程
openclaw gateway --dev # 开发模式
openclaw gateway --verbose # 详细日志
openclaw gateway --tailscale serve|funnel # Tailscale 暴露

日志查看

1
2
3
4
5
6
openclaw logs                  # 查看网关日志
openclaw logs --follow # 实时跟踪日志
openclaw logs --limit 500 # 限制行数
openclaw logs --json # JSON 格式输出
openclaw logs --plain # 纯文本输出

RPC 调用

1
2
3
4
5
openclaw gateway call <方法> [--params '<JSON>']   # 调用 RPC 方法
openclaw gateway health # 获取健康状态
openclaw gateway probe # 探测网关
openclaw gateway discover # 发现网关


消息与会话

发送消息

1
2
3
4
5
6
7
8
9
10
11
# 基本发送
openclaw message send --target <目标> --message "内容"

# 指定频道
openclaw message send --channel whatsapp --target +8613800138000 --message "你好"
openclaw message send --channel telegram --target @mychat --message "Hi"
openclaw message send --channel discord --target channel:123456 --message "Hello"

# 发送媒体
openclaw message send --target +8613800138000 --message "看这个" --media /path/to/image.jpg

消息子命令

命令说明
openclaw message send发送消息
openclaw message poll发送投票
openclaw message react添加反应表情
openclaw message read标记已读
openclaw message edit编辑消息
openclaw message delete删除消息
openclaw message pin置顶消息
openclaw message search搜索消息
openclaw message thread create创建话题
openclaw message thread list列出话题

会话管理

1
2
3
4
openclaw sessions                    # 列出所有会话
openclaw sessions --active 60 # 最近60分钟活跃的会话
openclaw sessions --json # JSON 格式输出

Agent 对话

1
2
3
4
5
6
7
8
9
10
11
12
# 通过网关与 Agent 对话
openclaw agent --message "帮我总结今天的新闻"

# 指定会话
openclaw agent --message "继续" --to +8613800138000

# 本地模式
openclaw agent --message "你好" --local

# 直接发送回复
openclaw agent --message "总结" --to +8613800138000 --deliver


频道管理

基本命令

命令说明
openclaw channels list列出已配置的频道和账号
openclaw channels status检查频道连接状态
openclaw channels logs查看频道日志
openclaw channels add添加频道账号
openclaw channels remove移除频道账号
openclaw channels login登录频道(扫码)
openclaw channels logout登出频道

支持的频道

  • whatsapp - WhatsApp
  • telegram - Telegram
  • discord - Discord
  • slack - Slack
  • signal - Signal
  • imessage - iMessage
  • googlechat - Google Chat
  • msteams - Microsoft Teams
  • mattermost - Mattermost(插件)

添加频道示例

1
2
3
4
5
6
7
8
9
10
11
12
# Telegram Bot
openclaw channels add --channel telegram --token $TELEGRAM_BOT_TOKEN

# Discord Bot
openclaw channels add --channel discord --account work --name "Work Bot" --token $DISCORD_BOT_TOKEN

# WhatsApp(扫码登录)
openclaw channels login --channel whatsapp

# 多账号
openclaw channels add --channel telegram --account alerts --name "Alerts Bot" --token $TOKEN

频道状态检查

1
2
3
4
openclaw channels status            # 基本状态
openclaw channels status --probe # 深度检查
openclaw channels list --json # JSON 输出


模型配置

查看与设置

命令说明
openclaw models list列出可用模型
openclaw models status查看模型配置和认证状态
openclaw models set <模型ID>设置默认主模型
openclaw models set-image <模型ID>设置图像模型
openclaw models scan扫描并推荐最佳模型

模型别名

1
2
3
4
openclaw models aliases list                 # 列出别名
openclaw models aliases add <别名> <模型ID> # 添加别名
openclaw models aliases remove <别名> # 删除别名

回退模型

1
2
3
4
5
openclaw models fallbacks list               # 列出回退模型
openclaw models fallbacks add <模型ID> # 添加回退模型
openclaw models fallbacks remove <模型ID> # 删除回退模型
openclaw models fallbacks clear # 清空回退列表

认证管理

1
2
3
4
openclaw models auth add                     # 交互式添加认证
openclaw models auth setup-token # 使用 setup-token(Anthropic)
openclaw models auth paste-token # 粘贴令牌

查看使用量

1
2
3
openclaw status --usage                      # 显示模型提供商用量/配额
openclaw models status --probe # 实时探测模型状态


定时任务

任务管理

命令说明
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 run <ID>立即执行任务
openclaw cron runs --id <ID>查看执行历史

添加任务示例

1
2
3
4
5
6
7
8
9
10
11
12
# 每小时提醒
openclaw cron add --name "每小时提醒" --every 1h --system-event "该休息一下了"

# 指定时间执行
openclaw cron add --name "早间提醒" --at "2026-03-10T09:00:00" --system-event "早安!新的一天开始了"

# Cron 表达式
openclaw cron add --name "工作日早间" --cron "0 9 * * 1-5" --system-event "开始工作"

# 发送消息任务
openclaw cron add --name "日报提醒" --cron "0 18 * * *" --message "记得写日报"


记忆系统

命令

命令说明
openclaw memory status查看记忆索引状态
openclaw memory index重建记忆索引
openclaw memory search "<查询>"语义搜索记忆

示例

1
2
3
4
5
6
7
8
9
# 搜索记忆
openclaw memory search "上次讨论的项目"

# 重建索引
openclaw memory index

# 查看状态
openclaw memory status --json

记忆文件结构

1
2
3
4
5
6
7
~/.openclaw/workspace/
├── MEMORY.md # 长期记忆(手动维护)
├── memory/
│ ├── 2026-03-10.md # 每日记录
│ └── 2026-03-09.md
└── HEARTBEAT.md # 心跳任务


配置管理

基本命令

命令说明
openclaw config启动配置向导(无子命令时)
openclaw config get <路径>获取配置值
openclaw config set <路径> <值>设置配置值
openclaw config unset <路径>删除配置值
openclaw config file显示配置文件路径
openclaw config validate验证配置

示例

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
# 获取配置
openclaw config get agents.defaults.model.primary
openclaw config get gateway.port
openclaw config get channels.telegram.accounts.default.token

# 设置配置
openclaw config set agents.defaults.model.primary "claude-3-opus"
openclaw config set gateway.port 18789

# 删除配置
openclaw config unset agents.defaults.thinking

# 验证配置
openclaw config validate

配置路径示例

1
2
3
4
5
6
7
agents.defaults.model.primary       # 主模型
agents.defaults.thinking # 思考模式
agents.defaults.timeoutSeconds # 超时时间
gateway.port # 网关端口
gateway.auth.token # 网关令牌
channels.telegram.enabled # Telegram 启用状态


技能系统

命令

命令说明
openclaw skills list列出可用技能
openclaw skills info <名称>查看技能详情
openclaw skills check检查技能依赖状态

示例

1
2
3
4
5
6
7
8
9
10
11
12
# 列出技能
openclaw skills list

# 只显示就绪的技能
openclaw skills list --eligible

# 查看详情
openclaw skills info weather

# 检查依赖
openclaw skills check --verbose

安装技能

1
2
3
# 使用 clawhub 搜索和安装技能
npx clawhub


安全与诊断

安全审计

1
2
3
4
openclaw security audit              # 基本审计
openclaw security audit --deep # 深度审计(包括网关探测)
openclaw security audit --fix # 自动修复安全问题

健康检查

1
2
3
4
5
6
openclaw health                      # 获取网关健康状态
openclaw health --json # JSON 输出
openclaw doctor # 快速诊断
openclaw doctor --deep # 深度诊断
openclaw doctor --yes # 自动接受默认修复

密钥管理

1
2
3
openclaw secrets reload              # 重新加载密钥引用
openclaw secrets audit # 审计密钥安全


浏览器控制

管理命令

命令说明
openclaw browser status浏览器状态
openclaw browser start启动浏览器
openclaw browser stop停止浏览器
openclaw browser tabs列出标签页
openclaw browser open <URL>打开网页
openclaw browser close [ID]关闭标签页
openclaw browser profiles列出配置文件

检查命令

命令说明
openclaw browser screenshot截图
openclaw browser snapshot获取页面结构(ARIA/AI 格式)

操作命令

命令说明
openclaw browser navigate <URL>导航到 URL
openclaw browser click <ref>点击元素
openclaw browser type <ref> <文本>输入文本
openclaw browser press <键>按键
openclaw browser hover <ref>悬停
openclaw browser drag <start> <end>拖拽
openclaw browser select <ref> <值>选择
openclaw browser upload <文件>上传文件
openclaw browser fill --fields '<JSON>'填充表单
openclaw browser wait --time <ms>等待
openclaw browser evaluate --fn '<代码>'执行 JavaScript

示例

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
# 打开网页
openclaw browser open https://example.com

# 截图
openclaw browser screenshot --full-page

# 获取页面结构
openclaw browser snapshot --format aria

# 点击元素
openclaw browser click e123

# 输入文本
openclaw browser type e456 "Hello World" --submit


节点管理

设备配对

1
2
3
4
5
openclaw devices list                # 列出已配对设备
openclaw devices approve <请求ID> # 批准配对请求
openclaw devices reject <请求ID> # 拒绝配对请求
openclaw devices remove <设备ID> # 移除设备

节点操作

1
2
3
4
5
6
7
8
9
10
11
12
13
openclaw nodes status                # 节点状态
openclaw nodes list # 列出节点
openclaw nodes describe --node <ID> # 节点详情

# 远程执行命令
openclaw nodes run --node <ID> ls -la

# 发送通知
openclaw nodes notify --node <ID> --title "提醒" --body "内容"

# 获取位置
openclaw nodes location get --node <ID>

相机操作

1
2
3
4
openclaw nodes camera list --node <ID>
openclaw nodes camera snap --node <ID> --facing front
openclaw nodes camera clip --node <ID> --duration 10s

屏幕录制

1
2
openclaw nodes screen record --node <ID> --duration 30s --fps 30

Canvas 操作

1
2
3
4
openclaw nodes canvas snapshot --node <ID>
openclaw nodes canvas present --node <ID> --target https://example.com
openclaw nodes canvas hide --node <ID>


更新与维护

更新

1
2
3
openclaw update                      # 更新 OpenClaw
openclaw update --check # 检查更新

备份

1
2
3
openclaw backup create               # 创建备份
openclaw backup verify <文件> # 验证备份

重置

1
2
3
4
5
openclaw reset                       # 重置配置(保留 CLI)
openclaw reset --scope config # 只重置配置
openclaw reset --scope config+creds+sessions # 重置配置+凭证+会话
openclaw reset --scope full # 完全重置

卸载

1
2
3
openclaw uninstall                   # 卸载网关服务和数据
openclaw uninstall --all # 完全卸载


全局参数

参数说明
--dev开发模式(状态隔离到 ~/.openclaw-dev
--profile <名称>使用命名配置文件
--no-color禁用彩色输出
--log-level <级别>日志级别:silent
-V, --version显示版本号
-h, --help显示帮助

输出格式

参数说明
--jsonJSON 格式输出
--plain纯文本输出

常用场景示例

场景1:首次安装

1
2
3
4
5
6
7
8
9
10
11
12
# 安装后初始化
openclaw setup --wizard

# 配置模型
openclaw configure

# 安装为服务
openclaw gateway install

# 启动服务
openclaw gateway start

场景2:连接 Telegram

1
2
3
4
5
6
7
8
9
# 添加 Telegram Bot
openclaw channels add --channel telegram --token $TELEGRAM_BOT_TOKEN

# 检查状态
openclaw channels status --probe

# 发送测试消息
openclaw message send --channel telegram --target @mychat --message "测试"

场景3:连接 WhatsApp

1
2
3
4
5
6
7
8
9
# 登录 WhatsApp
openclaw channels login --channel whatsapp

# 扫描二维码后检查状态
openclaw channels status

# 发送消息
openclaw message send --target +8613800138000 --message "你好"

场景4:设置定时提醒

1
2
3
4
5
6
7
8
9
# 每天早上9点提醒
openclaw cron add --name "早间提醒" --cron "0 9 * * *" --system-event "早安!新的一天开始了"

# 工作日下班提醒
openclaw cron add --name "下班提醒" --cron "0 18 * * 1-5" --system-event "该下班了,记得写日报"

# 查看任务
openclaw cron list

场景5:切换模型

1
2
3
4
5
6
7
8
9
# 查看可用模型
openclaw models list

# 设置默认模型
openclaw models set claude-3-opus

# 验证
openclaw models status

场景6:远程节点控制

1
2
3
4
5
6
7
8
9
# 查看已配对节点
openclaw nodes list

# 远程执行命令
openclaw nodes run --node my-mac -- open -a "Safari"

# 获取位置
openclaw nodes location get --node my-iphone

场景7:浏览器自动化

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
# 启动浏览器
openclaw browser start

# 打开网页
openclaw browser open https://github.com

# 获取页面结构
openclaw browser snapshot --format aria

# 截图
openclaw browser screenshot --full-page

# 关闭
openclaw browser stop



评论区(共34条)

2楼 - suguojian

学习了。谢谢佬

3楼 - handsome

感谢大佬

4楼 - Briden

学习学习,感谢大佬

5楼 - kkzdq

标记一下

6楼 - Huluma

很有用,谢谢佬

7楼 - Awaken

谢谢大佬分享

8楼 - zhangdong

感谢佬友分享

9楼 - wuxiaoyuan

佬友厉害了~

10楼 - cheviChan

真详细,先收藏,看不看另说

11楼 - ljm777

前排学习

12楼 - lgq139

感谢佬,收藏了

13楼 - youxiaohanpian

Uninstall 哦豁w

14楼 - linzee

mark一下,到时候ai帮我学

15楼 - nerokim

感谢分享

16楼 - yuki_z

感谢分享

17楼 - icbc

你是不是让 ai 总结的

18楼 - ibro

OpenClaw
thumbnail
🔗 https://docs.openclaw.ai/cli

官方文档有哇

19楼 - 578382239

感谢佬友整理

20楼 - longaotian88

感谢分享 有用

22楼 - Katoyu

感谢佬友分享

23楼 - beaconx

openclaw onboard这个命令是在做配置吧,安装为系统服务如何理解?

24楼 - Casper

重点在于后半部分 –install-daemon 这个配置,作用就是把openclaw网关注册成系统后台服务,实现开机自启、后台常驻、重启后自动恢复等等

25楼 - magnet

可能很少去仔细看官方文档,这么多还是第一次看

26楼 - beaconx

感谢佬友解答!
我说怎么openclaw gateway start报错呢,估计就是没加这个参数的原因。

有两个问题请教下
1、我之前没加这个参数,现在有办法(不重新配置的情况)加上吗?
2、你的这个解答是哪里知道的,我看官方文档的这个命令参数解释里没讲呢。 一般AI的知识还不知道openclaw。

27楼 - Bee

这个指令单纯安装服务,不进行设置引导
假设你改变了安装方式(例如改用 fnm/bun),导致路径不同,这个就很好用了

1
2
3
4
systemctl --user enable --now openclaw-gateway && \
systemctl --user restart openclaw-gateway && \
systemctl --user status openclaw-gateway

其他还有配对指令例如

1
2
openclaw pairing approve discord <PAIRING_CODE> --notify

28楼 - iceuy

谢谢大佬总结

29楼 - rui_zhao1

特别详细!

30楼 - Vincent.liu

学习了 感谢分享!

31楼 - Magic_Conch

感谢大佬

32楼 - agcl

感谢,但我都用了怎么还去记命令呢,直接对话让来操作捏。

33楼 - Rickykiko

skills 好像被替换成了 plugins

34楼 - luoyang

怎么切换会话来着

35楼 - zemu

学习到了,感谢

36楼 - vwvw

太全面了,给ai搞个速查

  • 标题:
  • 作者: 菇太帷i
  • 创建于 : 2026-03-27 07:06:49
  • 更新于 : 2026-03-27 07:06:49
  • 链接: https://blog.gutawei.com/2026/03/27/Discourse收集箱/openclaw的一些常用命令汇总/
  • 版权声明: 本文章采用 CC BY-NC-SA 4.0 进行许可。
评论
目录