【2026 OPC计划】OpenClaw常用命令大全
根据官方文档和多个技术社区的实践,OpenClaw的命令体系可以分为终端CLI命令和聊天斜杠命令两大类。以下是从专业角度整理的常用命令速查手册。
一、终端CLI命令
终端CLI命令直接在操作系统的Shell中执行,格式为openclaw <命令>。
1. 基础操作与维护
|
|
|
|
openclaw --version |
|
|
openclaw --help |
|
|
openclaw tui |
|
|
openclaw dashboard |
|
|
openclaw restart |
|
|
openclaw stop |
|
|
openclaw update |
|
|
2. 安装与初始化
|
|
|
openclaw onboard |
|
openclaw onboard --install-daemon |
|
openclaw configure |
|
3. 诊断与排错
|
|
|
|
openclaw doctor |
|
|
openclaw doctor --fix |
|
|
openclaw status |
|
|
openclaw status --deep |
|
|
openclaw logs |
|
|
4. 模型管理
|
|
|
openclaw models list |
|
openclaw models set <提供商/模型名> |
|
openclaw models auth login --provider <提供商> |
|
切换示例:
openclaw models set bailian/qwen3-max-2026-01-23
openclaw models set minimax/MiniMax-M2.1
5. Gateway服务控制
|
|
|
openclaw gateway start |
|
openclaw gateway start --port 18789 |
|
openclaw gateway start -d |
|
openclaw gateway stop |
|
openclaw gateway restart |
|
openclaw gateway status |
|
openclaw gateway logs |
|
6. 技能管理
技能管理工具clawhub:
|
|
|
clawhub install <技能名> |
|
clawhub list |
|
clawhub update <技能名> |
|
clawhub uninstall <技能名> |
|
clawhub search <关键词> |
|
clawhub sync --all |
|
7. 通道管理
|
|
|
openclaw channels status |
|
openclaw channels list |
|
openclaw channels add --channel telegram --token <TOKEN> |
|
openclaw channels remove --channel <名称> |
|
openclaw channels logs |
|
8. 配置管理
|
|
|
openclaw config get |
|
openclaw config get models.default |
|
openclaw config set models.default gpt-4 |
|
openclaw config set providers.deepseek.apiKey "你的API-Key" |
|
openclaw config edit |
|
openclaw config path |
|
openclaw agents add XXXX |
|
二、聊天斜杠命令
斜杠命令在Web控制台、飞书、Telegram等聊天界面中使用,所有平台通用。
1. 会话管理
|
|
|
|
/new |
|
|
/new 任务描述 |
|
|
/compact |
|
|
/status |
|
|
/help
|
|
|
2. 模型切换
|
|
|
/model |
|
/model list |
|
/model <模型名> |
|
/model status |
|
模型别名简写:/model haiku → claude-haiku-4-5
3. Token与成本监控
|
|
|
/usage full |
|
/usage cost |
|
/usage off |
|
/context detail |
|
/cost |
|
4. 权限与执行控制
|
|
|
/exec host=sandbox security=allowlist |
|
/exec ask=always |
|
/approve <id> allow-once |
|
/approve <id> allow-always |
|
/elevated on |
|
5. 会话历史与子任务
|
|
|
/sessions list |
|
/sessions history |
|
/sessions spawn <任务> |
|
/subagents list |
|
/subagents stop <id> |
|
三、核心文件路径
|
|
|
~/.openclaw/openclaw.json |
|
~/.openclaw/workspace/ |
|
~/.openclaw/skills/ |
|
~/.openclaw/agents/<ID>/USER.md |
|
~/.openclaw/agents/<ID>/memory/ |
|
~/.openclaw/workspace/AGENTS.md |
|
~/.openclaw/workspace/SOUL.md |
|
四、标准急救流程
遇到异常,按以下顺序执行:
-
1.
openclaw doctor – 全面健康检查
-
2.
openclaw logs – 查看错误日志
-
3.
openclaw status – 确认服务状态
-
4.
openclaw restart – 重启服务
-
5.
openclaw doctor --fix – 尝试自动修复
配置修改固定流程:编辑配置文件 → 保存 → 执行openclaw restart
以上命令体系覆盖了OpenClaw从安装、配置、日常使用到故障排查的全流程,可根据实际需求选择使用。