📋OpenClaw的命令行工具功能非常强大,涵盖了从安装配置、服务管理到模型调度和技能开发的方方面面。根据搜索到的信息,OpenClaw拥有40+ 核心命令,若加上子命令和选项,数量远超 100 条 。这里为你整理了100 条最常用的命令及其作用,按功能分类,方便你查阅。
🚀全局标志与环境
命令/选项 | 作用 |
openclaw --version 或 -v | 查看当前安装的 OpenClaw 版本 。 |
openclaw --help | 获取所有命令的帮助信息 。 |
openclaw [command] --help | 查看特定命令的帮助详情,例如 openclaw config --help 。 |
openclaw --dev | 以开发模式运行,将状态隔离到 ~/.openclaw-dev 目录,避免影响生产环境 。 |
openclaw --profile <name> | 使用指定的配置档案运行,将状态隔离到 ~/.openclaw-<name> 下 。 |
openclaw --no-color | 在终端输出中禁用 ANSI 颜色代码 。 |
openclaw --json | 以 JSON 格式输出结果,便于其他程序解析 。 |
NO_COLOR=1 openclaw <command> | 通过环境变量强制禁用命令的输出颜色 。 |
⚙️安装、初始化与配置
命令 | 作用 |
curl -fsSL https://openclaw.ai/install.sh | bash | 在 macOS/Linux 上一键安装 OpenClaw 。 |
openclaw setup | 初始化配置和工作区 。 |
openclaw setup --wizard | 以向导模式运行初始化设置 。 |
openclaw setup --workspace <dir> | 初始化时指定智能体的工作区路径 。 |
openclaw onboard | 运行交互式新手向导,一站式设置网关、工作区和技能 。 |
openclaw onboard --install-daemon | 在向导完成后,将 OpenClaw 安装为系统后台服务并开机自启 。 |
openclaw onboard --reset | 在运行向导前重置所有配置、凭证、会话和工作区 。 |
openclaw onboard --flow quickstart | 以快速模式运行向导,跳过高级选项 。 |
openclaw configure | 进入交互式配置向导,修改模型、渠道等设置 。 |
openclaw config | 不带子命令时启动配置向导;带子命令时用于非交互式配置管理 。 |
openclaw config get | 查看完整配置 。 |
openclaw config get <path> | 查看特定配置项的值,如 openclaw config get models.default 。 |
openclaw config get --section providers | 查看特定模块的配置(如模型提供商) 。 |
openclaw config set <path> <value> | 设置配置项的值,例如 openclaw config set models.default mistral:mixtral-8x7b 。 |
openclaw config set cache.enabled true | 启用缓存以提升响应速度 。 |
openclaw config set workspace ~/.openclaw/sandbox | 配置工作目录为沙盒目录,限制 AI 的操作范围 。 |
openclaw config unset <path> | 删除指定的配置项 。 |
openclaw uninstall | 卸载 OpenClaw 并清理相关文件 。 |
openclaw reset | 重置配置、凭证和工作区到初始状态 。 |
🧰 Gateway 服务控制
命令 | 作用 |
openclaw gateway | 不带子命令时在前台运行 Gateway 服务,用于调试 。 |
openclaw gateway install | 将 Gateway 安装为系统后台服务(如 systemd) 。 |
openclaw gateway uninstall | 卸载 Gateway 系统服务 。 |
openclaw gateway start | 后台启动 Gateway 守护进程 。 |
openclaw gateway start --port 19000 | 在自定义端口上启动 Gateway 服务 。 |
openclaw gateway start --force | 强制启动 Gateway,杀死占用端口的进程 。 |
openclaw gateway stop | 停止后台运行的 Gateway 守护进程 。 |
openclaw gateway restart | 重启 Gateway 服务 。 |
openclaw gateway status | 查看 Gateway 服务的运行状态 。 |
openclaw gateway run | 运行 Gateway 的某个特定命令或流程 。 |
openclaw gateway call | 调用 Gateway 的内部接口或功能 。 |
openclaw gateway health | 检查 Gateway 的健康状况 。 |
openclaw gateway probe | 探测 Gateway 的可用性和响应 。 |
openclaw gateway discover | 发现网络上的其他 Gateway 实例 。 |
📊状态、日志与诊断
命令 | 作用 |
openclaw status | 查看 OpenClaw 当前的整体运行状态 。 |
openclaw health | 执行健康检查,确认核心服务是否正常 。 |
openclaw doctor | 运行全面诊断,检查配置和服务的常见问题 。 |
openclaw doctor --fix | 自动检测并尝试修复发现的问题(如配置错误) 。 |
openclaw logs | 查看 OpenClaw 的运行日志 。 |
journalctl --user -u openclaw-gateway.service -f | (Linux)实时查看 Gateway 系统服务的日志 。 |
systemctl --user restart openclaw-gateway | (Linux)通过 systemd 重启 Gateway 服务 。 |
openclaw security audit | 审计配置和本地状态中的安全隐患 。 |
openclaw security audit --deep | 进行深度安全审计,包括实时的 Gateway 探测 。 |
openclaw security audit --fix | 审计并自动修复安全问题,收紧安全策略 。 |
🤖模型与智能体管理
命令 | 作用 |
openclaw models | 列出所有可用的模型 。 |
openclaw models list | 同 openclaw models,列出模型列表 。 |
openclaw models status | 查看当前模型的状态和配置 。 |
openclaw models set <model-name> | 设置默认使用的模型,如 openclaw models set openrouter/auto 。 |
openclaw models set-image <model-name> | 为特定功能或任务设置专用模型 。 |
openclaw models scan | 扫描并发现可用的新模型 。 |
openclaw models aliases list | 列出所有模型别名 。 |
openclaw models aliases add <alias> <model-id> | 为模型 ID 创建一个易于记忆的别名 。 |
openclaw models aliases remove <alias> | 删除一个模型别名 。 |
openclaw models fallbacks list | 列出当前配置的备用模型列表 。 |
openclaw models fallbacks add <model-id> | 添加一个备用模型,当主模型不可用时自动切换 。 |
openclaw models fallbacks remove <model-id> | 移除一个备用模型 。 |
openclaw models auth add | 为模型提供商添加新的认证信息(如 API Key) 。 |
openclaw models auth order get | 查看模型调用时的认证优先级顺序 。 |
openclaw agents list | 列出所有已配置的智能体(Agent) 。 |
openclaw agents add <name> | 添加一个新的智能体 。 |
openclaw agents delete <name> | 删除一个已有的智能体 。 |
📱渠道与设备管理
命令 | 作用 |
openclaw channels | 管理所有消息渠道的顶层命令 。 |
openclaw channels list | 列出所有已配置的消息渠道(如 Telegram、WhatsApp) 。 |
openclaw channels status | 检查各个渠道的连接和健康状态 。 |
openclaw channels logs | 查看渠道相关的日志 。 |
openclaw channels add | 以向导模式添加一个新的消息渠道 。 |
openclaw channels remove | 移除一个消息渠道 。 |
openclaw channels login | 登录渠道(例如用于 WhatsApp Web 的扫码登录) 。 |
openclaw channels logout | 登出渠道 。 |
openclaw devices list | 列出所有请求连接的设备 。 |
openclaw devices approve <requestId> | 批准某个设备的连接请求 。 |
openclaw devices reject <requestId> | 拒绝某个设备的连接请求 。 |
openclaw pairing list | 列出所有待处理的配对请求 。 |
openclaw pairing approve <id> | 批准一个配对请求 。 |
openclaw nodes | 管理移动节点(iOS/Android)的顶层命令 。 |
openclaw node install | 在节点上安装 OpenClaw 组件 。 |
openclaw node status | 查看已连接节点的状态 。 |
🛠️技能、插件与工具链
命令 | 作用 |
openclaw skills | 管理技能(Skills)的顶层命令 。 |
openclaw skills list | 列出所有已安装的技能 。 |
openclaw skills info <name> | 查看特定技能的详细信息 。 |
openclaw skills check | 检查技能的依赖和配置是否正确 。 |
openclaw skills add <skill_name> | 从远程仓库安装一个新技能 。 |
openclaw plugins | 管理插件的顶层命令 。 |
openclaw plugins list | 列出所有已发现的插件 。 |
openclaw plugins info <id> | 查看插件详情 。 |
openclaw plugins install <path> | 从本地路径或 npm 包安装插件 。 |
openclaw plugins enable <id> | 启用一个已安装的插件 。 |
openclaw plugins disable <id> | 禁用一个插件 。 |
openclaw plugins doctor | 诊断插件的加载错误 。 |
📝记忆、会话与浏览器
命令 | 作用 |
openclaw memory status | 查看长期记忆的索引统计信息 。 |
openclaw memory index | 手动触发重新索引记忆文件 。 |
openclaw memory search "<query>" | 在长期记忆中进行语义搜索 。 |
openclaw sessions | 管理当前会话的顶层命令 。 |
openclaw sessions list | 列出所有活跃的会话 。 |
openclaw browser | 控制 AI 的浏览器实例的顶层命令 。 |
openclaw browser start | 启动浏览器实例 。 |
openclaw browser stop | 停止浏览器实例 。 |
openclaw browser status | 查看浏览器状态 。 |
openclaw browser open <url> | 在浏览器中打开指定网址 。 |
openclaw browser screenshot | 对当前浏览器页面进行截图 。 |
⏰自动化与系统
命令 | 作用 |
openclaw cron | 管理定时任务的顶层命令 。 |
openclaw cron list | 列出所有配置的定时任务 。 |
openclaw cron add <schedule> <command> | 添加一个新的定时任务 。 |
openclaw cron runs | 查看定时任务的运行记录 。 |
openclac system heartbeat | 管理心跳机制,让 AI 能定期主动执行任务 。 |
openclaw system heartbeat enable | 启用心跳 。 |
openclaw system presence | 管理在线状态或“出席”信息 。 |
openclaw sandbox list | 列出所有沙盒环境 。 |
openclaw sandbox recreate | 重建沙盒环境 。 |
openclaw update | 升级 OpenClaw 到最新版本 。 |
openclaw docs | 在终端中打开或查看文档 。 |
openclaw tui | 启动终端用户界面(Text-based User Interface),直接在终端与 AI 对话 。 |
openclaw dashboard | 在浏览器中打开 Web 控制台仪表板 。 |
openclaw webhooks | 管理 Webhook 的顶层命令 。 |
💬聊天斜杠命令
命令 | 作用 |
/reset 或 /clear | 在聊天窗口中发送,强制清空当前会话的短期记忆,开始全新的对话上下文 。 |
/status | 在聊天窗口中快速诊断当前 AI 和系统的状态 。 |
/config | 在聊天窗口中直接修改持久化的配置项 。 |
/debug | 在聊天窗口中临时覆盖运行时配置(不写入磁盘,需启用 commands.debug) 。 |
掌握这些命令,你就能像一位经验丰富的“驯龙师”一样,从各个维度驾驭OpenClaw,让它真正成为你得力的智能助手。如果想深入了解某个命令的细节,随时可以问我。
夜雨聆风