数亿元!蚂蚁AGI研究中心主任大模型创业,拿下新融资
2026-08-03 3438790
2026-08-03 0

OpenClaw 是一个强大的 AI 助手框架,但有 40+ 核心命令,记不住怎么办?
别担心!本文为你整理了 20+ 最常用的 OpenClaw 命令,按功能分类,并提供实战示例,让你的日常工作效率提升 5 倍!
无论是配置管理、消息发送、技能部署,还是 Gateway 控制,都能在这里找到快速答案。
# 查看所有命令openclaw --help# 查看版本号openclaw --version# 查看特定命令的帮助openclaw--help# 示例:查看 config 命令帮助openclaw config --help
# 首次安装后初始化配置openclaw setup# 交互式引导配置(推荐新手)openclaw onboard#配置 + 安装系统后台服务(开机自启)openclaw onboard --install-daemon# 打开控制面板openclaw dashboard
# 查看完整配置openclaw config get# 查看特定配置项openclaw config get models.defaultopenclaw config get providers.mistral.apiKey# 查看特定部分配置openclaw config get --section modelsopenclaw config get --section providers
示例输出:
{ "models": { "default": "mistral:mixtral-8x7b" }, "providers": { "mistral": { "apiKey": "***REDACTED***" } }}# 设置默认模型openclaw config set models.default mistral:mixtral-8x7b# 设置快速模型openclaw config set models.fast mistral:mistral-7b# 配置 Mistral API Keyopenclaw config set providers.mistral.apiKey YOUR_API_KEY_HERE# 启用缓存openclaw config set cache.enabled trueopenclaw config set cache.maxSize 5000
# 删除特定配置项openclaw config unset models.fast# 重置某个节点openclaw config unset models
# 打开完整配置向导openclaw configure# 打开特定部分配置向导openclaw configure --section modelsopenclaw configure --section providersopenclaw configure --section channels
# 启动 Gateway(默认端口 18789)openclaw gateway start# 自定义端口启动openclaw gateway start --port 19000# 强制启动(杀死占用进程)openclaw gateway start --force# 停止 Gatewayopenclaw gateway stop# 重启 Gatewayopenclaw gateway restart# 查看运行状态openclaw gateway status
# 前台运行 Gateway(调试用)openclaw gateway# 开发模式运行(隔离状态)openclaw --dev gateway# 查看健康状态openclaw health
# 查看实时日志openclaw logs# 查看最近 50 行日志openclaw logs --lines 50# 查看错误日志openclaw logs --filter error# 持续监控日志openclaw logs --follow
# 使用 systemd 管理(推荐生产环境)sudo systemctl start openclaw-gatewaysudo systemctl stop openclaw-gatewaysudo systemctl restart openclaw-gatewaysudo systemctl status openclaw-gateway# 开机自启动sudo systemctl enable openclaw-gateway
# 发送消息到当前会话openclaw message send --message "Hello"# 发送到特定目标(Telegram)openclaw message send --channel telegram --target @mychat --message "Hello from OpenClaw"# 发送到特定目标(WhatsApp)openclaw message send --channel whatsapp --target +8613800138000 --message "您好"# 发送到 Slack 频道openclaw message send --channel slack --target C1234567890 --message "@channel 重要通知"
# 发送图片openclaw message send --channel telegram --target @mychat --media /tmp/photo.jpg --caption "这是一张图片"# 发送音频openclaw message send --channel whatsapp --target +8613800138000 --media /tmp/voice.mp3# 发送文档openclaw message send --channel telegram --target @mychat --media /tmp/report.pdf
# 发送 JSON 格式(脚本自动化)openclaw message send --target @mychat --message "Hello" --json# 回复消息openclaw message send --target @mychat --message "收到" --replyTo 12345# 指定频道openclaw message send --channel discord --target channel:1234567890 --message "Hello"
# 创建投票(Telegram)openclaw message send --channel telegram --target @mychat --pollQuestion "OpenClaw 好用吗?" --pollOption 非常好用 --pollOption 一般 --pollOption 还需要改进 --pollDurationHours 24# 发送反应(Discord)openclaw message send --channel discord --messageId 1234567890 --emoji ? --action react
# 查看所有已安装技能openclaw skills list# 搜索技能openclaw skills search weather# 查看技能详情openclaw skills show weather
# 安装技能openclaw skills install weather# 从指定来源安装openclaw skills install weather --source github# 指定版本安装openclaw skills install [email protected]# 卸载技能openclaw skills uninstall weather
# 更新所有技能openclaw skills update# 更新特定技能openclaw skills update weather# 同步技能openclaw skills sync
# 创建新技能openclaw skills create my-skill# 验证技能openclaw skills validate my-skill# 打包技能openclaw skills pack my-skill
# 查看所有配置的模型openclaw models list# 查看默认模型openclaw models default# 查看模型详情openclaw models show mistral:mixtral-8x7b
# 设置默认模型openclaw models set-default mistral:mixtral-8x7b# 添加新模型openclaw models add --name my-model --provider mistral --id mistral-medium --maxTokens 8192# 测试模型openclaw models test --model mistral:mixtral-8x7b --prompt "Hello, OpenClaw!"
# 临时指定模型openclaw agent --model mistral:mistral-7b --message "快速响应"# 使用内置模型别名openclaw agent --model fast --message "这个用fast模型"openclaw agent --model premium --message "这个用premium模型"
# 查看所有配置的频道openclaw channels list# 查看频道状态openclaw channels status# 查看特定频道详情openclaw channels show telegram
# Telegram 登录openclaw channels login --channel telegram# WhatsApp 登录(会显示 QR 码)openclaw channels login --channel whatsapp --verbose# Slack 登录openclaw channels login --channel slack# Discord 登录openclaw channels login --channel discord
# 测试频道连接openclaw channels test --channel telegram# 发送测试消息openclaw channels test --channel telegram --target @mychat --message "测试消息"
# 配置频道openclaw channels configure --channel telegram# 更新频道 Tokenopenclaw channels update --channel telegram --token NEW_TOKEN# 启用/禁用频道openclaw channels enable telegramopenclaw channels disable telegram
# 列出所有会话openclaw sessions# 列出活跃会话openclaw sessions --active# 列出特定频道的会话openclaw sessions --channel telegram# 显示最近 10 个会话openclaw sessions --limit 10
# 查看特定会话的历史openclaw sessions history# 查看最近的消息openclaw sessions history --limit 20# 导出会话历史openclaw sessions history --export > history.json
# 发送消息到会话openclaw sessions send --session--message "你好"# 重置会话openclaw sessions reset # 删除会话openclaw sessions delete
# 查看所有配对的节点openclaw nodes list# 查看节点状态openclaw nodes status# 描述节点详情openclaw nodes describe
# 发送通知到节点openclaw nodes notify --node my-phone --title "提醒" --body "该吃饭了"# 设置推送优先级openclaw nodes notify --node my-phone --priority timeSensitive --title "紧急通知" --body "快递到了"# 查看相册(手机)openclaw nodes camera-list --node my-phone# 拍照openclaw nodes camera-snap --node my-phone --facing back --output /tmp/photo.jpg
# 启动配对openclaw node pairing start# 查看待配对节点openclaw nodes pending# 批准配对openclaw nodes approve --node# 拒绝配对openclaw nodes reject --node
# 搜索记忆openclaw memory search "OpenClaw 配置"# 搜索并显示多行上下文openclaw memory search "配置" --lines 5# 搜索特定路径的记忆openclaw memory search "配置" --path MEMORY.md# 限制结果数量openclaw memory search "配置" --maxResults 10
# 查看记忆统计openclaw memory stats# 清理过期记忆openclaw memory clean# 备份记忆openclaw memory backup --output /tmp/memory-backup.json
# 列出所有任务openclaw cron list# 查看任务运行历史openclaw cron runs# 查看调度器状态openclaw cron status
# 创建定时任务(每天凌晨触发)openclaw cron add --name "daily-report" --schedule "0 0 * * *" --text "生成每日报告"# 创建重复任务(每 30 分钟)openclaw cron add --name "check-notifications" --schedule "*/30 * * * *" --text "检查通知"# 创建单次任务(特定时间)openclaw cron add --name "special-task" --schedule "at" --at "2026-03-01T10:00:00" --text "执行特殊任务"
# 立即运行任务openclaw cron run# 更新任务openclaw cron update --schedule "0 6 * * *"# 删除任务openclaw cron remove # 发送唤醒事件openclaw cron wake --text "检查新消息"
# 运行健康检查openclaw doctor# 快速修复常见问题openclaw doctor --fix# 检查特定组件openclaw doctor --check gatewayopenclaw doctor --check channels
# 查看频道健康状态openclaw status# 查看系统事件openclaw system events# 查看心跳状态openclaw system heartbeat
# 运行安全检查openclaw security audit# 检查权限配置openclaw security check-permissions# 检查 API Key 有效性openclaw security verify-keys
# 查看已安装插件openclaw plugins list# 查看插件详情openclaw plugins show# 检查插件状态openclaw plugins status
# 启用插件openclaw plugins enable feishu# 禁用插件openclaw plugins disable feishu# 重启插件openclaw plugins restart feishu# 更新插件openclaw plugins update
# 启动浏览器openclaw browser start# 停止浏览器openclaw browser stop# 切换配置openclaw browser start --profile chromeopenclaw browser start --profile openclaw
# 打开网页openclaw browser open https://example.com# 截图openclaw browser screenshot --output /tmp/screenshot.png# 获取快照openclaw browser snapshot --target main# 查看标签页openclaw browser tabs
# 查看更新openclaw update --dry-run# 执行更新openclaw update# 更新到特定版本openclaw update --tag 2026.2.22# 更新到 Beta 版openclaw update --channel beta
# 备份配置cp ~/.openclaw/config.json ~/.openclaw/config.json.backup# 重置配置(保留 CLI)openclaw reset# 完全卸载(包括数据)openclaw uninstall
# 生成 Bash 补全脚本openclaw completion bash > ~/.openclaw-completion# 生成 Zsh 补全脚本openclaw completion zsh > ~/.zsh-completion# 应用补全(Bash)echo "source ~/.openclaw-completion" >> ~/.bashrcsource ~/.bashrc
# 一键创建、开发、测试技能openclaw skills create my-new-skill && cd ~/.openclaw/workspace/skills/my-new-skill && vim SKILL.md
# 发送到多个目标openclaw message send --target @user1 --message "通知内容"openclaw message send --target @user2 --message "通知内容"openclaw message send --target @user3 --message "通知内容"# 使用循环批量发送(需要脚本配合)for target in user1 user2 user3; do openclaw message send --target @$target --message "通知内容"done
# 重启并验证openclaw gateway restart && sleep 5 && openclaw gateway status && openclaw health
# 安全更新流程cp ~/.openclaw/config.json ~/.openclaw/config.json.backup && openclaw update --dry-run && openclaw update && openclaw gateway restart
# 生成每日报告(Cron 脚本)0 9 * * * openclaw cron add --name daily-report --schedule "0 9 * * *" --text "生成昨日数据分析报告"
# 检查端口占用sudo lsof -i :18789# 强制重启openclaw gateway start --force# 查看错误日志openclaw logs --filter error# 运行健康检查openclaw doctor
# 检查频道状态openclaw channels status# 测试频道openclaw channels test --channel telegram# 重新登录频道openclaw channels login --channel telegram# 查看详细日志openclaw message send --target @mychat --message "Test" --verbose
# 检查 API Keyopenclaw config get providers.openai.apiKey# 测试模型openclaw models test --model mistral:mixtral-8x7b --prompt "test"# 检查网络连接ping api.openai.com# 运行诊断openclaw doctor --check models
# 检查技能列表openclaw skills list# 验证技能openclaw skills validate my-skill# 重新安装技能openclaw skills uninstall my-skillopenclaw skills install my-skill# 查看错误日志openclaw logs --filter skill
# 推荐方式:使用环境变量存储敏感信息export OPENAI_API_KEY="sk-xxx"export MISTRAL_API_KEY="xxx"export TELEGRAM_BOT_TOKEN="xxx"# 然后启动 Gatewayopenclaw gateway start
# 限制配置文件权限chmod 600 ~/.openclaw/config.json# 检查权限ls -la ~/.openclaw/config.json
# 配置日志轮转sudo tee /etc/logrotate.d/openclaw <18.4 监控与告警
# 检查 Gateway 状态(Cron 脚本)*/5 * * * * openclaw health || openclaw message send --target @admin --message "Gateway 宕机!"十九、快捷别名配置
19.1 创建常用别名
# 添加到 ~/.bashrc 或 ~/.zshrcalias oc='openclaw'alias ocg='openclaw gateway'alias ocgl='openclaw logs --follow'alias ocs='openclaw sessions'alias ocm='openclaw message send'alias occ='openclaw channels'# 应用别名source ~/.bashrc # Bashsource ~/.zshrc # Zsh19.2 使用别名
# 启动 Gatewayocg start# 查看实时日志ocgl# 发送消息ocm --target @mychat --message "Hello"# 查看会话ocs二十、命令速查表
总结