一、基础与安装命令
1.1 版本与环境
| 命令 | 功能 | 示例 |
|---|---|---|
openclaw --version / -V |
查看当前版本 | openclaw --version |
openclaw --help / -h |
显示所有命令帮助 | openclaw --help |
openclaw tui |
启动终端交互界面 | openclaw tui |
openclaw dashboard |
打开网页管理控制台 | openclaw dashboard |
1.2 安装与初始化
| 命令 | 功能 | 说明 |
|---|---|---|
openclaw setup |
初始化配置和工作区 | 首次安装后必须执行 |
openclaw onboard |
交互式引导流程 | 依次配置Gateway、工作区、Skills |
openclaw configure |
交互式配置向导 | 修改模型、频道、技能等核心配置 |
openclaw update |
更新CLI到最新版本 | openclaw update --channel stable |
openclaw uninstall |
卸载Gateway服务和相关数据 | openclaw uninstall --all --yes |
1.3 全局选项
| 选项 | 功能 | 说明 |
|---|---|---|
--dev |
开发模式 | 独立配置+端口18790 |
--profile |
多配置文件隔离 | 工作/个人环境分开 |
--log-level |
设置日志级别 | silent/fatal/error/warn/info/debug/trace |
--no-color |
禁用彩色输出 | 脚本中使用 |
--json |
JSON格式输出 | 机器可读格式 |
二、配置管理命令
2.1 配置读写
| 命令 | 功能 | 示例 |
|---|---|---|
openclaw config get |
读取指定配置值 | openclaw config get gateway.port |
openclaw config set |
设置配置值 | openclaw config set gateway.port 18789 |
openclaw config unset |
删除配置项 | openclaw config unset channels.telegram |
openclaw config file |
显示配置文件路径 | openclaw config file |
openclaw config validate |
校验配置文件有效性 | openclaw config validate |
2.2 常用配置路径
|
1
2
3
4
5
6
7
8
|
# 设置网关模式openclaw config set gateway.mode local# 设置绑定模式openclaw config set gateway.bind loopback# 设置API密钥openclaw config set providers.anthropic.apiKey "sk-ant-xxxxx"# 禁用记忆搜索openclaw config set agents.defaults.memorySearch.enabled false |
三、网关服务命令
3.1 生命周期管理
| 命令 | 功能 | 说明 |
|---|---|---|
openclaw gateway / openclaw gateway run |
前台运行Gateway | 常搭配screen或tmux使用 |
openclaw gateway start |
后台启动Gateway服务 | 系统服务方式运行 |
openclaw gateway stop |
停止Gateway服务 | 临时暂停或维护 |
openclaw gateway restart |
重启Gateway服务 | 修改配置后最常用 |
openclaw gateway status |
探测Gateway RPC状态 | 检查服务是否存活 |
3.2 服务安装
| 命令 | 功能 | 说明 |
|---|---|---|
openclaw gateway install |
安装为系统服务 | systemd/launchd等 |
openclaw gateway uninstall |
卸载系统服务 | 彻底移除服务 |
3.3 调试与发现
| 命令 | 功能 | 示例 |
|---|---|---|
openclaw gateway call |
调用指定RPC方法 | openclaw gateway call health |
openclaw gateway probe |
探测Gateway | 调试连接问题时使用 |
openclaw gateway discover |
发现局域网中的Gateway实例 | 多实例环境使用 |
3.4 网关选项
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
|
# 指定端口启动openclaw gateway --port 18789# 强制杀掉占用端口并启动openclaw gateway --force# 详细日志输出openclaw gateway --verbose# 设置命令超时时间openclaw gateway --timeout 30000# 绑定模式设置openclaw gateway --bind loopback # 仅本地openclaw gateway --bind lan # 局域网openclaw gateway --bind tailnet # Tailscale网络 |
四、模型管理命令
4.1 基本操作
| 命令 | 功能 | 示例 |
|---|---|---|
openclaw models list |
列出所有可用模型 | openclaw models list |
openclaw models status |
模型状态概览 | openclaw models status |
openclaw models status --probe |
带探测的模型状态检查 | 深度检查模型可用性 |
openclaw models set |
设置默认模型 | openclaw models set glm-4.7-flash |
openclaw models set-image |
设置图片生成模型 | openclaw models set-image dalle-3 |
4.2 别名管理
| 命令 | 功能 | 示例 |
|---|---|---|
openclaw models aliases list |
列出模型别名 | openclaw models aliases list |
openclaw models aliases add |
添加模型别名 | openclaw models aliases add gpt gpt-4 |
openclaw models aliases remove |
移除模型别名 | openclaw models aliases remove gpt |
4.3 回退模型
| 命令 | 功能 | 说明 |
|---|---|---|
openclaw models fallbacks list |
列出回退模型列表 | 主模型不可用时使用 |
openclaw models fallbacks add |
添加回退模型 | openclaw models fallbacks add glm-4.7 |
openclaw models fallbacks remove |
移除回退模型 | 清理不需要的回退模型 |
openclaw models fallbacks clear |
清空回退模型列表 | 重置回退配置 |
4.4 认证管理
| 命令 | 功能 | 说明 |
|---|---|---|
openclaw models auth add |
添加模型认证 | 配置API密钥 |
openclaw models auth setup-token |
交互式设置API token | 推荐使用OAuth流程 |
openclaw models auth paste-token |
直接粘贴API token | 快速配置 |
openclaw models auth order get |
查看认证提供商顺序 | 优先级排序 |
openclaw models auth order set |
设置认证提供商顺序 | 调整认证优先级 |
五、渠道管理命令
5.1 渠道操作
| 命令 | 功能 | 示例 |
|---|---|---|
openclaw channels list |
显示所有已配置频道 | openclaw channels list |
openclaw channels status |
检查频道健康状态 | openclaw channels status |
openclaw channels status --probe |
带深度探测的频道状态检查 | 详细诊断 |
openclaw channels add |
向导式添加新频道 | openclaw channels add |
openclaw channels login |
交互式登录 | WhatsApp扫码登录 |
openclaw channels login --channel |
登录指定频道 | openclaw channels login --channel whatsapp |
openclaw channels logout |
登出频道 | 断开连接 |
openclaw channels remove |
禁用并移除频道 | openclaw channels remove --channel telegram |
5.2 渠道添加示例
|
1
2
3
4
5
6
7
8
9
10
11
|
# Telegramopenclaw channels add --channel telegram --token "BOT_TOKEN"# Discordopenclaw channels add --channel discord --token "BOT_TOKEN"# WhatsApp(扫码登录)openclaw channels login --channel whatsapp# 飞书openclaw channels add --channel feishu --app-id "APP_ID" --app-secret "APP_SECRET" |
六、技能与插件命令
6.1 技能管理
| 命令 | 功能 | 示例 |
|---|---|---|
openclaw skills list |
列出所有已加载技能 | openclaw skills list |
openclaw skills info |
查看指定技能详细信息 | openclaw skills info browser |
openclaw skills check |
就绪/缺失状态摘要 | 检查技能依赖 |
openclaw skills install |
安装新技能 | openclaw skills install browser |
openclaw skills enable |
启用技能 | openclaw skills enable browser |
openclaw skills disable |
禁用技能 | openclaw skills disable browser |
6.2 插件管理
| 命令 | 功能 | 示例 |
|---|---|---|
openclaw plugins list |
发现并列出所有插件 | openclaw plugins list |
openclaw plugins info |
查看插件详细信息 | openclaw plugins info feishu |
openclaw plugins install |
安装插件 | 支持本地路径、tgz或npm包名 |
openclaw plugins enable |
启用插件 | openclaw plugins enable feishu |
openclaw plugins disable |
禁用插件 | openclaw plugins disable feishu |
openclaw plugins doctor |
插件加载错误诊断报告 | 排查插件问题 |
6.3 ClawHub社区技能
|
1
2
3
4
5
6
7
8
9
10
11
|
# 搜索技能clawhub search "weather"# 安装技能clawhub install weather# 同步所有技能clawhub sync --all# 列出已安装技能clawhub list |
七、消息与会话命令
7.1 消息操作
| 命令 | 功能 | 示例 |
|---|---|---|
openclaw message send |
发送消息 | openclaw message send --target +15555550123 --message "Hi" |
openclaw message edit |
编辑已发送的消息 | openclaw message edit --message-id 123 --message "Updated" |
openclaw message delete |
删除消息 | openclaw message delete --message-id 123 |
openclaw message poll |
创建投票 | openclaw message poll --question "Snack?" --option Pizza --option Sushi |
openclaw message react |
添加/移除反应 | openclaw message react --emoji "✅" |
openclaw message broadcast |
广播消息到多个目标 | 群发消息 |
7.2 会话管理
| 命令 | 功能 | 示例 |
|---|---|---|
openclaw sessions list |
列出所有会话 | openclaw sessions list |
openclaw sessions history |
查看会话历史 | openclaw sessions history |
openclaw memory |
管理记忆 | openclaw memory search "会议记录" |
openclaw memory index |
重建向量索引 | 修复记忆索引错误 |
7.3 Agent管理
| 命令 | 功能 | 示例 |
|---|---|---|
openclaw agents list |
列出所有已配置的agents | openclaw agents list |
openclaw agents add [name] |
通过向导添加新agent | openclaw agents add assistant |
openclaw agents delete |
删除指定agent | openclaw agents delete old-assistant |
openclaw agents bindings |
列出所有路由绑定 | 查看agent与渠道的绑定关系 |
openclaw agents bind |
添加路由绑定 | 将agent绑定到频道/群组 |
openclaw agents unbind |
移除路由绑定 | 解除绑定关系 |
八、诊断与维护命令
8.1 健康检查
| 命令 | 功能 | 说明 |
|---|---|---|
openclaw doctor |
最有用的单条命令 | 全面健康检查并提供快速修复建议 |
openclaw doctor --fix |
自动修复常见问题 | 自动修正配置文件权限等 |
openclaw doctor --deep |
深度诊断 | 复杂故障排查 |
openclaw health |
获取运行中Gateway的健康状态 | 快速确认核心组件状态 |
openclaw status |
显示会话健康状态和最近接收者 | 整体运行状态概览 |
8.2 日志管理
| 命令 | 功能 | 示例 |
|---|---|---|
openclaw logs |
查看Gateway日志 | openclaw logs |
openclaw logs --follow |
实时查看运行日志 | 类似 tail -f |
openclaw logs --filter error |
仅查看错误日志 | 快速定位故障 |
openclaw logs --start "2026-03-13" |
指定开始时间 | 时间范围查询 |
openclaw logs --search "error" |
关键词过滤 | 搜索特定内容 |
8.3 系统管理
| 命令 | 功能 | 示例 |
|---|---|---|
openclaw system event --text |
向系统事件队列入队一条事件 | 测试事件系统 |
openclaw system heartbeat last |
查看上次心跳时间 | 检查定时任务 |
openclaw system heartbeat enable |
启用心跳 | 开启定时任务 |
openclaw system heartbeat disable |
禁用心跳 | 关闭定时任务 |
openclaw system presence |
列出系统在线状态 | 查看连接状态 |
8.4 安全与备份
| 命令 | 功能 | 说明 |
|---|---|---|
openclaw security audit |
安全审计 | 检查安全配置 |
openclaw security audit --deep |
深度安全审计 | 全面安全检查 |
openclaw secrets reload |
刷新敏感密钥 | 重新加载密钥 |
openclaw backup create |
创建系统备份 | 备份配置和数据 |
openclaw reset |
重置系统状态 | 谨慎使用,保留CLI |
openclaw uninstall --all --yes |
彻底卸载 | 清理所有数据 |
九、聊天斜杠命令(Slash Commands)
9.1 会话管理
| 命令 | 功能 | 说明 |
|---|---|---|
/new |
开启新会话线程 | 清空上下文,节省token |
/new <描述> |
带目标启动新会话 | 指定会话目标 |
/reset |
重置当前会话 | 同 /new |
/status |
查看当前会话状态 | 包括模型、上下文、队列等信息 |
/compact |
压缩上下文 | 释放上下文窗口空间 |
/history |
查看会话历史记录 | 浏览对话历史 |
/pause |
暂停当前任务 | 临时停止AI执行 |
9.2 模型控制
| 命令 | 功能 | 示例 |
|---|---|---|
/model <名称> |
切换模型 | /model glm-4.7-flash |
/reasoning |
开启/关闭深度推理模式 | /reasoning on |
/reasoning <级别> |
调整推理级别 | /reasoning high |
/think <级别> |
设置思考级别 | /think medium |
/verbose on/off |
开启/关闭详细输出 | /verbose on |
9.3 技能与工具
| 命令 | 功能 | 示例 |
|---|---|---|
/skills |
查看已安装技能 | 列出所有可用技能 |
/skill [input] |
直接运行技能 | /skill weather 北京 |
/agents |
查看可用Agent | 列出所有Agent |
/memory |
查看或管理AI的记忆 | 查询AI记住的信息 |
/forget |
忘记特定信息 | 清除记忆 |
9.4 操作控制
| 命令 | 功能 | 说明 |
|---|---|---|
/stop |
中止当前正在运行的任务 | 紧急停止 |
/approve |
批准配对请求 | 允许新联系人 |
/deny |
拒绝配对请求 | 拒绝新联系人 |
/cancel |
取消当前操作 | 取消正在执行的任务 |
/undo |
撤销上一步操作 | 回退操作 |
9.5 信息查询
| 命令 | 功能 | 说明 |
|---|---|---|
/help |
显示帮助信息 | 列出可用命令列表 |
/commands |
查看所有命令 | 同 /help |
/cost |
查看使用费用 | 查询API调用成本 |
/version |
查看版本信息 | 显示OpenClaw版本 |
/ping |
测试连接状态 | 检查服务是否正常 |
/deliver |
交付当前任务结果 | 完成并输出结果 |
十、高级与扩展命令
10.1 定时任务
| 命令 | 功能 | 示例 |
|---|---|---|
openclaw cron list |
查看定时任务 | openclaw cron list |
openclaw cron add |
添加定时任务 | openclaw cron add "0 9 * * *" "check_disk" |
openclaw cron edit |
编辑定时任务 | 修改任务配置 |
openclaw cron rm |
删除定时任务 | 移除指定任务 |
openclaw cron run |
立即执行定时任务 | 手动触发任务 |
10.2 浏览器控制
| 命令 | 功能 | 示例 |
|---|---|---|
openclaw browser start |
启动浏览器 | 开启浏览器实例 |
openclaw browser open |
打开网页 | openclaw browser open https://example.com |
openclaw browser click |
点击元素 | openclaw browser click "#login" |
openclaw browser type |
输入文本 | openclaw browser type "#username" "admin" |
openclaw browser screenshot |
截图 | 保存当前页面截图 |
10.3 节点管理
| 命令 | 功能 | 说明 |
|---|---|---|
openclaw node run |
前台运行headless node host | 调试模式 |
openclaw node start |
启动node host服务 | 后台运行 |
openclaw node stop |
停止node host服务 | 关闭节点 |
openclaw node restart |
重启node host服务 | 重新启动 |
openclaw node status |
显示node host状态 | 检查节点状态 |
openclaw nodes |
管理移动节点 | 查看所有节点 |
10.4 配对管理
| 命令 | 功能 | 说明 |
|---|---|---|
openclaw pairing list |
查看待处理的配对请求 | 审批新联系人 |
openclaw pairing approve |
批准配对请求 | 允许新联系人 |
openclaw pairing deny |
拒绝配对请求 | 拒绝新联系人 |
十一、故障排查流程
11.1 标准排查步骤
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
|
# 1. 检查状态openclaw gateway status# 2. 查看日志openclaw logs --follow# 3. 健康检查openclaw doctor# 4. 自动修复openclaw doctor --fix# 5. 重启服务openclaw gateway restart |
11.2 常见问题解决
| 问题 | 解决方案 |
|---|---|
| 配置修改不生效 | openclaw gateway restart |
| JSON语法错误 | openclaw doctor --fix |
| 网关宕机 | openclaw doctor --deep |
| 记忆索引错误 | openclaw memory index |
| 授权过期 | openclaw models auth setup-token |
| 不回复私聊 | 进入Pairing List手动批准 |
| 群聊静默 | 检查MentionPatterns配置 |
十二、命令使用频率统计
高频命令(每日使用)
openclaw gateway restart- 修改配置后必用openclaw doctor- 出问题先跑这个openclaw status- 快速检查状态openclaw logs --follow- 实时查看日志/new- 开启新会话
中频命令(每周使用)
openclaw models set- 切换模型openclaw skills install- 安装新技能openclaw channels status- 检查渠道连接openclaw config set- 修改配置clawhub search- 搜索技能
低频命令(每月使用)
openclaw update- 更新版本openclaw backup create- 创建备份openclaw security audit- 安全审计openclaw reset- 重置配置openclaw uninstall- 卸载系统
评论区
请 登录 后发表评论