刚整理的!OpenClaw命令按场景分类,最全命令合集,收藏这一篇就够了
说实话,OpenClaw 装上之后,我花了很久才把这些命令理清楚。文档是散的,用的时候现查,查完又忘。后来干脆自己按使用场景整理了一份,今天分享出来。
先说个大概
OpenClaw 的命令分两类:终端命令和聊天命令。两回事,别混着来。
终端里敲的是系统层面的东西,改了是持久的。聊天里发的是控制当前会话的,关掉窗口就没了。刚入门的时候我老搞混,后来记住一句话就够了:
终端管系统,聊天管会话。
一、先把 Gateway 跑起来
这是第一步。Gateway 跑不起来,后面都白搭。
|
|
|
|---|---|
|
|
openclaw onboard |
|
|
openclaw gateway start |
|
|
openclaw gateway stop |
|
|
openclaw gateway status |
|
|
openclaw gateway run
|
|
|
openclaw gateway install |
|
|
openclaw dashboard
|
|
|
openclaw tui |
💡 如果启动完什么都没反应,用
openclaw gateway run看报错信息,比猜原因快得多。
二、第一次配置要跑哪些
装完跑一遍配置向导,后面省事。
# 配置向导openclaw configure# 引导式初始化openclaw onboard# 强制重来openclaw onboard --force
手动改配置用这个:
# 设置端口openclaw config set gateway.port 18789# 指定默认模型openclaw config set agents.main.model "minimax/MiniMax-M2.7"
想看当前配置:
openclaw config get all # 全部openclaw config get gateway # 只看网关openclaw config file. # 配置文件在哪openclaw config validate # 验证格式
三、模型怎么管
openclaw models list # 列出已接入模型openclaw models status # 看运行状态openclaw models scan # 扫描可关联的模型openclaw models probe # 测试连通性openclaw models set default "模型名" # 设默认openclaw models set-image "模型名" # 设图像模型openclaw models fallbacks # 备用模型链
💡 接了新模型之后,先跑
probe确认能通再用,别等到实际调用的时候才发现问题。
四、频道登录:飞书/企微
openclaw channels list # 查看已接入了哪些openclaw channels status # 看连接状态openclaw channels status --probe # 深度检测,给修复建议openclaw channels logs # 渠道日志openclaw channels login feishu # 登录飞书
主动发消息给用户或群:
openclaw message send --target @用户名 --message"内容"openclaw message send --channel feishu --target @某人 --message"内容"
查找用户 ID:
openclaw channels resolve --channel feishu --name 张三
五、插件和扩展
openclaw plugins list # 装了哪些插件openclaw plugins install<包名> # 安装openclaw plugins uninstall <名> # 卸载openclaw plugins enable<名> # 启用openclaw plugins disable <名> # 禁用openclaw plugins doctor # 诊断问题openclaw plugins info <名> # 详情openclaw plugins update # 更新
Skills 相关:
openclaw skills list # 列出所有技能openclaw skills info <技能名> # 看某个详情openclaw skills check # 检查依赖是否就绪
六、定时任务:自动化全靠它
openclaw cron list # 现有任务列表openclaw cronadd--name"早提醒"--cron"0 8 * * *"--message"早"--channel feishuopenclaw cron run <任务名> # 立刻跑一次openclaw cron runs # 执行历史openclaw cron status # 调度器状态openclaw cron disable <ID> # 暂停openclaw cronenable<ID> # 启用openclaw cronrm<ID> # 删除
💡 定时任务通过 Gateway 触发,可以推送到飞书、企微等 IM 渠道。
七、消息和群管理
# 发消息openclaw message send --target @某人 --message"内容"openclaw message send --target @某人 --media image.png# 查消息openclaw message read--channel feishu --limit20openclaw message search --channel feishu --query"关键词"# 互动openclaw message react --channel feishu --message-id <id>--emoji"👍"openclaw message delete --channel feishu --message-id <id>
群成员操作:
openclaw message timeout--channel feishu --target @某人 --minutes10 # 禁言openclaw message kick --channel feishu --target @某人 # 踢人openclaw message ban --channel feishu --target @某人 # 封禁
八、日志:出问题先看这个
openclaw logs # 最近日志openclaw logs --follow # 实时跟踪openclaw logs --error # 只看错误openclaw logs --limit100 # 指定条数openclaw logs --json # JSON 格式openclaw logs --local-time # 本地时间戳
💡 Gateway 起不来?先
logs --follow,看实时报错信息,比重启十次都管用。
九、健康检查:遇到事先跑它
openclaw doctor # 全套诊断openclaw doctor --fix # 自动修复openclaw doctor --force # 强制修复(慎用)openclaw doctor --scan # 扫描系统服务
💡 大部分常见问题
doctor --fix都能自动搞定,建议把它当成第一步。
十、浏览器自动化
openclaw browser start # 启动openclaw browser stop # 停止openclaw browser navigate https://example.com # 打开网页openclaw browser screenshot # 截图openclaw browser type12"内容" # 输入文本openclaw browser click 12 # 点击openclaw browser click 12--submit # 提交表单openclaw browser press Enter # 回车openclaw browser wait--text"完成" # 等待元素openclaw browser wait--dialog--accept # 等待对话框并确认openclaw browser resize 1280720 # 调整窗口openclaw browser pdf # 输出 PDFopenclaw browser console --level error # 控制台错误openclaw browser evaluate --fn'...'--ref7 # 执行 JS
十一、智能体管理
openclaw agents list # 所有智能体openclaw agents add<名字> # 创建openclaw agents delete <名字> # 删除openclaw agents bindings # 查看绑定关系openclaw agents bind<名>--channel feishu # 绑定到渠道openclaw agents unbind <名>--channel feishu # 解绑openclaw agents set-identity --name 老码 --emoji 👨💻 # 设置身份
注意:
agent(单数)是触发一轮对话,agents(复数)是管理多个独立智能体。
十二、会话历史
openclaw sessions # 所有会话openclaw sessions --agent main # 指定智能体openclaw sessions --active120 # 最近两小时openclaw sessions --all-agents # 聚合全部openclaw sessions --json # JSON 输出openclaw sessions cleanup # 清理过期
组合场景:几个常用流程
新机器装完跑这套:
openclaw setupopenclaw onboardopenclaw models probeopenclaw gateway installopenclaw gateway startopenclaw logs --follow
Gateway起不来的时候跑这套:
openclaw gateway run --verboseopenclaw logs --erroropenclaw doctor --fix
接**飞书机器人**:
openclaw channels login feishuopenclaw channels statusopenclaw message send --channel feishu --target @某人 --message"连接成功"
记不住命令怎么办?
用 --help,比如:
openclaw gateway --helpopenclaw models --helpopenclaw channels --help
文档:https://docs.openclaw.ai/cli
这些命令我用了有一段时间了,确实比翻文档方便。有用就收藏,用到的时候回来查。有什么问题,评论区见。
夜雨聆风