⌨️ CLI 命令速查表

完整的 OpenClaw 命令行参考,忘了命令就翻这个

💡 提示:使用浏览器搜索 (Ctrl+F / Cmd+F) 快速查找命令

🚀 快速开始

openclaw --version 查看版本
openclaw --help 显示帮助
openclaw onboard 交互式配置向导
openclaw onboard --install-daemon 配置并安装后台服务

🦞 Gateway 管理

openclaw gateway start 启动 Gateway
openclaw gateway stop 停止 Gateway
openclaw gateway restart 重启 Gateway
openclaw gateway status 查看状态
openclaw gateway --port 18789 指定端口启动
openclaw gateway --verbose 详细日志模式
openclaw gateway install 安装为系统服务
openclaw gateway uninstall 卸载系统服务

🤖 AI 交互

openclaw agent 启动交互式 AI 会话
openclaw agent --message '你好' 发送单条消息
openclaw agent --thinking high 使用深度思考模式
openclaw agent --session work 指定会话名称
openclaw message send --to +123 --msg 'hi' 发送消息到指定频道
openclaw dashboard 打开 Web 控制台

📱 频道管理

openclaw channels list 列出所有频道
openclaw channels status 查看频道状态
openclaw channels login whatsapp 登录 WhatsApp
openclaw channels login telegram 登录 Telegram
openclaw channels login discord 登录 Discord
openclaw channels logout <channel> 登出频道
openclaw channels enable <channel> 启用频道
openclaw channels disable <channel> 禁用频道

🔧 配置管理

openclaw config get <key> 获取配置项
openclaw config set <key> <value> 设置配置项
openclaw config edit 编辑配置文件
openclaw config validate 验证配置
openclaw config show 显示完整配置
openclaw config import <file> 导入配置
openclaw config export 导出配置

💬 会话管理

openclaw sessions list 列出会话
openclaw sessions show <name> 查看会话详情
openclaw sessions delete <name> 删除会话
openclaw sessions prune 清理旧会话
openclaw sessions archive 归档所有会话

📱 节点管理

openclaw nodes list 列出已连接节点
openclaw nodes status 查看节点状态
openclaw nodes pending 查看待批准配对
openclaw nodes approve <id> 批准节点配对
openclaw nodes reject <id> 拒绝节点配对
openclaw nodes remove <id> 移除节点
openclaw nodes invoke --node <id> --cmd <cmd> 调用节点命令

🛠️ 工具与技能

openclaw skills list 列出已安装技能
openclaw skills install <name> 安装技能
openclaw skills uninstall <name> 卸载技能
openclaw skills update 更新所有技能
openclaw skills approve <name> 批准技能权限
openclaw tools list 列出可用工具
openclaw browser open 打开浏览器工具

🔐 配对管理

openclaw pairing list 列出配对列表
openclaw pairing approve <channel> <code> 批准配对请求
openclaw pairing reject <channel> <code> 拒绝配对请求
openclaw pairing remove <id> 移除配对

⏰ 定时任务

openclaw cron list 列出定时任务
openclaw cron add --name 'daily' --schedule '0 8 * * *' 添加任务
openclaw cron remove <name> 删除任务
openclaw cron run <name> 立即运行任务
openclaw cron enable <name> 启用任务
openclaw cron disable <name> 禁用任务

📊 监控与日志

openclaw logs 查看日志
openclaw logs --follow 实时跟踪日志
openclaw logs --since 1h 最近1小时日志
openclaw doctor 运行诊断检查
openclaw health 健康检查
openclaw status 整体状态

⚙️ 系统管理

openclaw update 检查更新
openclaw update --channel beta 切换到测试版
openclaw reset --config 重置配置
openclaw reset --data 重置数据(危险!)
openclaw uninstall 卸载 OpenClaw
openclaw system info 系统信息
openclaw system memory 内存使用情况

🚩 全局选项

这些选项可以用在任何命令上:

--verbose, -v 显示详细输出
--quiet, -q 静默模式
--config <path> 指定配置文件
--profile <name> 使用指定配置 profile
--json JSON 格式输出
--help, -h 显示帮助
--version, -V 显示版本

📝 常用示例

发送一条消息给 AI

openclaw agent --message '解释量子计算' --thinking high

查看 Gateway 状态并重启

openclaw gateway status && openclaw gateway restart

导出配置备份

openclaw config export > openclaw-backup-$(date +%Y%m%d).json

清理旧会话释放内存

openclaw sessions prune --older-than 7d

使用特定模型

openclaw agent --model claude-sonnet-4 --message 'Hello'

💡 CLI 使用技巧

自动补全

运行 openclaw completion > ~/.config/fish/completions/openclaw.fish

别名配置

在 ~/.bashrc 中添加: alias oc='openclaw'

管道使用

openclaw sessions list --json | jq '.[] | select(.name=="work")'

查看帮助

任何命令加 --help 查看详细用法,如: openclaw agent --help

故障排查 →