OpenClaw 教程三:核心指令速查 — 常用命令完全手册
本文汇总 OpenClaw 常用命令,方便快速查找。不管你是新手还是老手,都可以收藏这篇,随时备用。
一、基础指令
这些是你在对话中常用的指令:
| 指令 | 说明 | 示例 |
|---|---|---|
| /status | 查看当前状态 | /status — 显示模型、对话数等 |
| /thinking | 开关思考模式 | /thinking on /thinking off |
| /reasoning | 查看推理过程 | /reasoning — 显示思考过程 |
| /help | 获取帮助 | /help — 显示帮助信息 |
| // | 切换到管理员模式 | // — 执行管理命令 |
基础指令最常用的是 /status,建议记住。
二、Gateway 命令
Gateway 是核心服务,这些命令用来管理它:
查看状态
openclaw gateway status显示:运行时间、内存使用、连接数、配置信息等。
启动/停止
# 启动
openclaw gateway start
# 停止
openclaw gateway stop
# 重启(修改配置后用)
openclaw gateway restart配置相关
# 查看配置
openclaw gateway config
# 验证配置
openclaw gateway config validate三、Agent 管理
用来管理各个 Agent:
启动 Agent
# 启动指定 Agent
openclaw agent start -n myagent
# 指定模型启动
openclaw agent start -n myagent -m anthropic/claude-3-opus
# 指定配置启动
openclaw agent start -n myagent -c config.yaml停止 Agent
# 停止指定 Agent
openclaw agent stop -n myagent
# 停止所有 Agent
openclaw agent stop --all查看列表
# 查看所有 Agent
openclaw agent list
# 查看运行中的
openclaw agent list --runningAgent 交互
# 发送消息
openclaw agent chat -n myagent -m "帮我查下天气"
# 查看历史
openclaw agent history -n myagent四、文件操作
OpenClaw 的文件操作是通过工具实现的,不是指令。但在对话中可以这样用:
直接对话要求
# 读取文件
"帮我读取 /root/test.txt"
# 写入文件
"帮我创建一个文件,内容是..."
# 编辑文件
"把文件中第5行改成..."五、浏览器操作
浏览器控制也是通过工具:
// 打开网页
browser({ action: "open", url: "https://example.com" })
// 截图
browser({ action: "screenshot" })
// 点击元素
browser({
action: "act",
kind: "click",
ref: "按钮"
})
// 输入文本
browser({
action: "act",
kind: "fill",
ref: "输入框",
text: "内容"
})六、消息发送
// 发送到飞书
message({
action: "send",
channel: "feishu",
target: "用户ID或群ID",
message: "消息内容"
})
// 发送到 Telegram
message({
action: "send",
channel: "telegram",
target: "chat_id",
message: "消息内容"
})七、实用技巧
1. 对话切换
// — 使用 // 切换到管理员模式
// 然后可以执行管理命令2. 任务委派
/spawn — 派生子任务处理复杂工作3. 管道命令
| — 流式处理,比如日志分析
ls -la | grep error4. 后台任务
--background 或 & — 后台运行
openclaw agent start -n myagent &5. 日志查看
openclaw logs
openclaw logs --tail 100
openclaw logs --level error八、技能相关
# 列出所有技能
openclaw skill list
# 查看技能详情
openclaw skill info weather
# 安装技能
openclaw skill install weather
# 卸载技能
openclaw skill uninstall weather九、定时任务
# 添加定时任务
openclaw cron add "任务名" --schedule "0 9 * * 1-5"
# 列出任务
openclaw cron list
# 删除任务
openclaw cron delete "任务名"cron 表达式说明:
┌───────────── 分钟 (0 - 59)
│ ┌─────────── 小时 (0 - 23)
│ │ ┌───────── 日期 (1 - 31)
│ │ │ ┌─────── 月份 (1 - 12)
│ │ │ ┌───── 星期 (0 - 6,0=周日)
│ │ │ │
* * * * * 命令
示例:
0 9 * * 1-5 # 每周一到周五早上9点
0 */2 * * * # 每隔2小时
0 0 * * * # 每天午夜十、快速查询表
| 场景 | 命令 |
|---|---|
| 查看状态 | openclaw gateway status |
| 重启 | openclaw gateway restart |
| 停止 | openclaw gateway stop |
| 启动Agent | openclaw agent start -n 名字 |
| 查看日志 | openclaw logs --tail 100 |
| 查看版本 | openclaw --version |
十一、接下来的教程
这些命令够你日常使用了。进阶的话,建议看看技能系统,可以扩展更多能力。
传送门:教程四:技能系统详解
本文作者:小文 · 2026年5月
© 版权声明
文章版权归作者所有,未经允许请勿转载。
THE END








暂无评论内容