使用说明
本速查表按功能分组列出 OpenClaw 的所有常用 CLI 命令。你可以用浏览器的Ctrl+F(或 Cmd+F)搜索关键词快速定位。
所有命令的基本格式:
``bash
openclaw <命令> [选项]
`
查看任意命令的帮助信息:
`bash
openclaw <命令> --help
`
安装管理
| 命令 | 说明 | 示例 |
|------|------|------|
| openclaw onboard | 首次安装引导向导,交互式配置 | openclaw onboard |
| openclaw update | 更新 OpenClaw 到最新版本 | openclaw update |
| openclaw uninstall | 卸载 OpenClaw | openclaw uninstall |
| openclaw --version | 查看当前版本号 | openclaw --version |
Gateway 管理
| 命令 | 说明 | 示例 |
|------|------|------|
| openclaw gateway status | 查看 Gateway 运行状态 | openclaw gateway status |
| openclaw gateway restart | 重启 Gateway 服务 | openclaw gateway restart |
| openclaw gateway stop | 停止 Gateway 服务 | openclaw gateway stop |
| openclaw gateway install | 将 Gateway 安装为系统服务 | openclaw gateway install |
| openclaw gateway run | 前台运行 Gateway(调试用) | openclaw gateway run |
> 💡 gateway install 会根据系统自动选择 systemd(Linux)、launchd(macOS)或计划任务(Windows)。
技能管理
| 命令 | 说明 | 示例 |
|------|------|------|
| clawhub install | 安装指定技能 | clawhub install docker-sandbox |
| clawhub list | 列出已安装的技能 | clawhub list |
| clawhub update --all | 更新所有已安装技能 | clawhub update --all |
| clawhub update | 更新指定技能 | clawhub update docker-sandbox |
| clawhub uninstall | 卸载指定技能 | clawhub uninstall docker-sandbox |
| clawhub inspect | 查看技能详细信息 | clawhub inspect docker-sandbox |
| clawhub sync | 发布/同步技能到 ClawHub | clawhub sync |
> 💡 技能安装后存储在 ~/.openclaw/skills/ 目录下。
渠道管理
| 命令 | 说明 | 示例 |
|------|------|------|
| openclaw channels status | 查看所有渠道连接状态 | openclaw channels status |
| openclaw channels login | 登录/配对渠道 | openclaw channels login whatsapp |
| openclaw channels list | 列出已配置的渠道 | openclaw channels list |
会话管理
| 命令 | 说明 | 示例 |
|------|------|------|
| openclaw sessions list | 列出所有会话 | openclaw sessions list |
| openclaw sessions history | 查看会话历史记录 | openclaw sessions history |
| openclaw sessions prune | 清理过期会话 | openclaw sessions prune |
> 💡 在聊天中发送 /new 开始新会话,/reset 重置当前会话。
配置管理
| 命令 | 说明 | 示例 |
|------|------|------|
| openclaw config | 查看当前配置 | openclaw config |
| openclaw configure | 交互式修改配置 | openclaw configure |
| openclaw setup | 初始化工作区 | openclaw setup |
配置文件位置:~/.openclaw/openclaw.json
诊断工具
| 命令 | 说明 | 示例 |
|------|------|------|
| openclaw doctor | 全面诊断环境问题 | openclaw doctor |
| openclaw health | 快速健康检查 | openclaw health |
| openclaw status | 查看系统整体状态 | openclaw status |
> 💡 遇到问题时,先跑一遍 openclaw doctor,它会自动检测常见问题并给出修复建议。
记忆管理
| 命令 | 说明 | 示例 |
|------|------|------|
| openclaw memory status | 查看记忆系统状态 | openclaw memory status |
| openclaw memory search <关键词> | 语义搜索记忆内容 | openclaw memory search "数据库配置" |
| openclaw memory index | 重建记忆索引 | openclaw memory index |
记忆文件位置:~/.openclaw/workspace/MEMORY.md
定时任务(Cron)
| 命令 | 说明 | 示例 |
|------|------|------|
| openclaw cron list | 列出所有定时任务 | openclaw cron list |
| openclaw cron add | 添加定时任务 | openclaw cron add "每天早上9点发日报" |
| openclaw cron remove | 删除定时任务 | openclaw cron remove 3 |
Cron 表达式示例:
`bash
每天早上 9 点
openclaw cron add --schedule "0 9 * * *" --message "生成今日工作报告"
每周一上午 10 点
openclaw cron add --schedule "0 10 * * 1" --message "检查本周待办事项"
每小时
openclaw cron add --schedule "0 * * * *" --message "检查邮箱新邮件"
`
Hooks 管理
| 命令 | 说明 | 示例 |
|------|------|------|
| openclaw hooks list | 列出所有 Hooks | openclaw hooks list |
| openclaw hooks add | 添加新 Hook | openclaw hooks add |
| openclaw hooks remove | 删除 Hook | openclaw hooks remove 2 |
浏览器管理
| 命令 | 说明 | 示例 |
|------|------|------|
| openclaw browser-login | 在浏览器中登录网站,保存 Cookie | openclaw browser-login |
> 💡 登录后的 Cookie 会被浏览器工具自动使用,适合需要登录才能访问的网站。
智能体与交互
| 命令 | 说明 | 示例 |
|------|------|------|
| openclaw agent | 启动智能体交互 | openclaw agent |
| openclaw agent --message "..." | 发送单条消息 | openclaw agent --message "你好" |
| openclaw tui | 启动终端 UI 界面 | openclaw tui |
| openclaw logs | 查看运行日志 | openclaw logs |
插件管理
| 命令 | 说明 | 示例 |
|------|------|------|
| openclaw plugins install | 安装插件 | openclaw plugins install voice-call |
| openclaw plugins list | 列出已安装插件 | openclaw plugins list |
| openclaw plugins remove | 卸载插件 | openclaw plugins remove voice-call |
> 💡 插件安装后需要重启 Gateway 才能生效:openclaw gateway restart
聊天内置命令
除了 CLI 命令,OpenClaw 还支持在聊天中使用斜杠命令:
| 命令 | 说明 |
|------|------|
| /new | 开始新会话 |
| /reset | 重置当前会话 |
| /stop | 停止当前任务 |
| /status | 查看状态 |
| /help | 查看帮助 |
常用组合
首次安装完整流程
`bash
1. 安装
curl -fsSL https://get.openclaw.ai | bash
2. 引导配置
openclaw onboard
3. 检查环境
openclaw doctor
4. 启动 Gateway
openclaw gateway run
5. 安装一个技能试试
clawhub install docker-sandbox
`
日常运维
`bash
检查状态
openclaw status
更新版本
openclaw update
更新所有技能
clawhub update --all
查看日志
openclaw logs
`
排查问题
`bash
全面诊断
openclaw doctor
检查 Gateway 状态
openclaw gateway status
查看渠道连接
openclaw channels status
查看日志
openclaw logs
`
环境变量
一些常用的环境变量可以影响 CLI 行为:
| 变量 | 说明 | 示例 |
|------|------|------|
| OPENCLAW_HOME | 自定义数据目录 | export OPENCLAW_HOME=~/my-openclaw |
| OPENCLAW_LOG_LEVEL | 日志级别 | export OPENCLAW_LOG_LEVEL=debug |
小结
这份速查表覆盖了 OpenClaw 的所有常用命令。建议收藏本页,遇到不确定的命令时随时查阅。记住两个万能命令:
- openclaw doctor — 遇到问题先跑诊断
- openclaw <命令> --help` — 查看任意命令的详细帮助
#OpenClawCLI #命令速查表 #命令行工具 #CLI参考 #龙虾技能库