OpenClaw常用操作命令完整速查手册(2026最新汉化版)

  发布时间:2026-04-13 17:26:26   作者:python全栈小辉   我要评论
这份速查手册详细介绍了OpenClaw中文汉化版2026.4.1-zh.2及以上的命令使用方法,涵盖了终端CLI操作、聊天斜杠指令、实用技巧与常见问题解决等内容,帮助用户高效操作和维护该软件

适用版本:OpenClaw 中文汉化版 v2026.4.1-zh.2 及以上

命令前缀说明

  • 终端命令:使用 openclaw-cn(汉化版专属命令,官方版为 openclaw
  • 聊天斜杠指令:在Web控制台/微信/钉钉/飞书聊天窗口直接输入,以 / 开头

第一部分:终端 CLI 操作命令大全

基础全局命令

命令说明示例
openclaw-cn --version查看当前版本号openclaw-cn --version
openclaw-cn --help查看所有命令帮助openclaw-cn --help
openclaw-cn <command> --help查看指定命令的详细帮助openclaw-cn gateway --help
openclaw-cn tui启动终端图形交互界面(新手友好)openclaw-cn tui
openclaw-cn dashboard自动打开浏览器访问Web控制台openclaw-cn dashboard
openclaw-cn docs <query>内置文档搜索openclaw-cn docs "微信接入"

全局通用标志

  • --json:输出JSON格式,适合脚本调用
  • --verbose:显示详细日志
  • --dev:开发模式,状态隔离到 ~/.openclaw-dev
  • --profile <name>:多实例隔离,状态存储在 ~/.openclaw-<name>

安装与初始化

命令说明示例
openclaw-cn onboard启动交互式初始化配置向导openclaw-cn onboard
openclaw-cn onboard --install-daemon初始化并安装系统后台服务(开机自启)openclaw-cn onboard --install-daemon
openclaw-cn configure重新进入配置向导openclaw-cn configure
openclaw-cn update一键更新到最新稳定版openclaw-cn update
openclaw-cn update --nightly更新到每日构建版openclaw-cn update --nightly
openclaw-cn uninstall --all --yes彻底卸载,删除所有数据openclaw-cn uninstall --all --yes

网关服务管理(核心)

命令说明示例
openclaw-cn gateway run前台启动网关服务(调试用)openclaw-cn gateway run
openclaw-cn gateway start后台启动网关服务openclaw-cn gateway start
openclaw-cn gateway stop停止网关服务openclaw-cn gateway stop
openclaw-cn gateway restart重启网关服务(配置修改后必用)openclaw-cn gateway restart
openclaw-cn gateway status查看网关运行状态、端口占用、链路健康度openclaw-cn gateway status
openclaw-cn gateway install注册网关为系统服务,实现开机自启openclaw-cn gateway install
openclaw-cn gateway uninstall卸载系统服务openclaw-cn gateway uninstall
openclaw-cn gateway probe深度探测网关连通性,排查网络拦截问题openclaw-cn gateway probe

配置管理

命令说明示例
openclaw-cn config show查看当前完整配置openclaw-cn config show
openclaw-cn config get <key>查询指定配置项的值openclaw-cn config get language
openclaw-cn config set <key> <value>快速修改单条配置openclaw-cn config set language zh-CN
openclaw-cn config edit调用系统编辑器修改配置文件openclaw-cn config edit
openclaw-cn config validate校验配置文件语法与合法性openclaw-cn config validate
openclaw-cn config reset重置为默认配置(会覆盖所有修改)openclaw-cn config reset

模型管理

命令说明示例
openclaw-cn models list列出所有已配置的模型openclaw-cn models list
openclaw-cn models set <model-name>设置默认使用的模型openclaw-cn models set claude-4-sonnet-20260301
openclaw-cn models add <provider> <api-key>添加新的模型提供商openclaw-cn models add openai sk-xxx
openclaw-cn models remove <model-name>删除指定模型openclaw-cn models remove gpt-3.5-turbo
openclaw-cn models status查看所有模型的连接状态openclaw-cn models status
openclaw-cn models scan自动扫描本地Ollama模型openclaw-cn models scan
openclaw-cn models usage查看模型API用量和剩余配额openclaw-cn models usage

技能与插件管理

命令说明示例
openclaw-cn skills list列出所有已安装的技能openclaw-cn skills list
openclaw-cn skills install <skill-name>从ClawHub安装技能openclaw-cn skills install pdf-processor
openclaw-cn skills install <local-path>从本地目录安装技能openclaw-cn skills install ./my-skill
openclaw-cn skills update <skill-name>更新指定技能openclaw-cn skills update pdf-processor
openclaw-cn skills update --all更新所有已安装的技能openclaw-cn skills update --all
openclaw-cn skills uninstall <skill-name>卸载指定技能openclaw-cn skills uninstall pdf-processor
openclaw-cn plugins list列出所有已安装的插件openclaw-cn plugins list
openclaw-cn plugins install <plugin-name>安装插件openclaw-cn plugins install vscode-bridge

渠道平台管理(微信/钉钉/飞书)

命令说明示例
openclaw-cn channels list列出所有已配置的聊天渠道openclaw-cn channels list
openclaw-cn channels add --channel <name>添加新的聊天渠道openclaw-cn channels add --channel wechat
openclaw-cn channels remove --channel <name>删除指定渠道openclaw-cn channels remove --channel telegram
openclaw-cn channels status查看所有渠道的连接状态openclaw-cn channels status
openclaw-cn channels logs --channel <name>查看指定渠道的日志openclaw-cn channels logs --channel dingtalk
openclaw-cn message send --channel <name> --target <id> --message <text>发送消息openclaw-cn message send --channel wechat --target "张三" --message "你好"

Agent 与会话管理

命令说明示例
openclaw-cn agents list列出所有已创建的Agentopenclaw-cn agents list
openclaw-cn agents add <name> --workspace <path>创建新的Agentopenclaw-cn agents add work --workspace ~/projects
openclaw-cn agents delete <id> --force删除指定Agentopenclaw-cn agents delete 1 --force
openclaw-cn agent --message <text>向默认Agent发送消息openclaw-cn agent --message "列出当前目录文件"
openclaw-cn sessions list列出所有会话openclaw-cn sessions list
openclaw-cn sessions delete <id>删除指定会话openclaw-cn sessions delete 1
openclaw-cn sessions export <id> --format markdown导出会话为Markdown文件openclaw-cn sessions export 1 --format markdown

数据与记忆管理

命令说明示例
openclaw-cn memory status查看记忆系统状态openclaw-cn memory status
openclaw-cn memory index重建向量索引(修复记忆Bug必用)openclaw-cn memory index
openclaw-cn memory search "<query>"向量搜索长期记忆openclaw-cn memory search "Python"
openclaw-cn memory clear清除所有长期记忆openclaw-cn memory clear
openclaw-cn directory add <path>添加目录到文件访问白名单openclaw-cn directory add ~/Documents
openclaw-cn directory list列出所有允许访问的目录openclaw-cn directory list

诊断与维护(遇到问题先执行这些)

命令说明示例
openclaw-cn doctor全面健康检查(配置、端口、依赖)openclaw-cn doctor
openclaw-cn doctor --fix健康检查+自动修复常见错误openclaw-cn doctor --fix
openclaw-cn status --all完整系统状态诊断openclaw-cn status --all
openclaw-cn status --deep深度探测所有组件状态openclaw-cn status --deep
openclaw-cn logs查看最近100行日志openclaw-cn logs
openclaw-cn logs --follow实时查看日志(排查问题必备)openclaw-cn logs --follow
openclaw-cn logs --level error只查看错误日志openclaw-cn logs --level error

备份与恢复

命令说明示例
openclaw-cn backup create创建完整数据备份openclaw-cn backup create
openclaw-cn backup list列出所有备份openclaw-cn backup list
openclaw-cn backup restore <backup-id>从指定备份恢复openclaw-cn backup restore 20260413-120000
openclaw-cn backup delete <backup-id>删除指定备份openclaw-cn backup delete 20260413-120000

高级命令

命令说明示例
openclaw-cn cron list列出所有定时任务openclaw-cn cron list
openclaw-cn cron add "0 9 * * *" "发送每日日报"添加定时任务openclaw-cn cron add "0 9 * * *" "发送每日日报"
openclaw-cn security audit执行安全审计openclaw-cn security audit
openclaw-cn sandbox run <command>在沙箱中执行命令openclaw-cn sandbox run "ls -la"
openclaw-cn mcp list列出所有已连接的MCP服务器openclaw-cn mcp list

第二部分:聊天斜杠指令大全

(在Web控制台/微信/钉钉/飞书聊天窗口直接输入)

基础控制指令

指令说明示例
/help显示所有可用斜杠命令/help
/help <command>查看指定命令的详细用法/help model
/new/clear开启新会话,清除上下文缓存/new
/reset重置会话到初始状态(恢复默认参数)/reset
/stop强制停止当前正在生成的内容或任务/stop
/status显示当前对话状态、模型、Token使用量/status
/context详细展示当前对话的上下文构成/context
/whoami显示当前发送者的身份标识/whoami
/export将当前会话导出为Markdown文件/export

模型与参数调整

指令说明示例
/model <model-name>临时切换当前会话使用的模型/model claude-4-opus
/think <level>设置思考深度:off/minimal/low/medium/high/xhigh/think high
/temperature <value>调整生成温度(0-2),值越高越随机/temperature 0.7
/maxtokens <value>设置最大生成Token数/maxtokens 2048
/fast on/off开启/关闭快速响应模式/fast on
/compact压缩当前会话上下文(用摘要替代历史,节省Token)/compact

工具与技能

指令说明示例
/tools列出当前可用的所有工具及其描述/tools
/skills列出所有已安装的技能/skills
/skill <skill-name> <args>手动调用指定技能/skill pdf-extract test.pdf
/bash <command>在主机上执行Shell命令/bash ls -la
/file list列出当前工作目录的文件/file list
/file read <filename>读取指定文件内容/file read README.md
/file write <filename> <content>写入内容到指定文件/file write test.txt "Hello World"

系统管理

指令说明示例
/restart重启网关服务(仅管理员可用)/restart
/config get <key>读取指定配置项的值/config get language
/config set <key> <value>修改指定配置项/config set default_model gpt-4o
/usage off/tokens/full控制Token用量显示的详细程度/usage full
/verbose on/off开关详细模式,显示工具调用和推理步骤/verbose on
/tts on/off开启/关闭语音回复/tts on

高级功能

指令说明示例
/subagent spawn <role>生成并启动一个子代理处理复杂任务/subagent spawn "前端工程师"
/btw <question>询问一个临时问题,不被加入长期对话记忆/btw "今天是几号?"
/activation mention/always切换激活模式:仅@提及触发/所有消息都触发/activation always
/elevated临时提升Agent权限(需管理员密码)/elevated
/mcp list列出所有已连接的MCP服务器/mcp list

第三部分:实用技巧与常见问题

命令别名设置(提高效率)

Linux/macOS

# 添加到 ~/.bashrc 或 ~/.zshrc
alias oc='openclaw-cn'
alias ocg='openclaw-cn gateway'
alias ocs='openclaw-cn status'
alias ocd='openclaw-cn doctor --fix'
alias ocl='openclaw-cn logs --follow'

# 生效
source ~/.bashrc

Windows PowerShell

# 添加到 $PROFILE
Set-Alias oc openclaw-cn
Set-Alias ocg openclaw-cn-gateway
Set-Alias ocs openclaw-cn-status
Set-Alias ocd openclaw-cn-doctor
Set-Alias ocl openclaw-cn-logs

万能问题排查命令组合

遇到任何问题,先执行这三条命令,能解决80%的常见错误:

openclaw-cn doctor --fix && \
openclaw-cn gateway restart && \
openclaw-cn logs --follow

常见问题快速解决

  1. 服务启动失败:先执行 openclaw-cn doctor --fix,再重启服务
  2. 汉化不生效:执行 openclaw-cn config set language zh-CN,然后重启服务
  3. AI不回复:执行 openclaw-cn models status 检查模型连接状态
  4. 技能安装失败:配置国内技能镜像:openclaw-cn config set skillRegistry https://openclaw.cn/skills
  5. 无法访问本地文件:添加目录到白名单:openclaw-cn directory add ~/Documents

总结

这份速查手册涵盖了OpenClaw中文汉化版99%的常用操作命令,建议收藏并打印出来放在电脑旁,遇到问题随时查阅。记住:遇到问题先执行 openclaw-cn doctor --fix,这是解决大多数问题的最快方法。

如果需要更详细的命令说明,可以执行 openclaw-cn <command> --help 查看官方帮助文档

到此这篇关于OpenClaw常用操作命令完整速查手册(2026最新汉化版)的文章就介绍到这了,更多相关OpenClaw常用操作命令内容请搜索脚本之家以前的文章或继续浏览下面的相关文章,希望大家以后多多支持脚本之家!

相关文章

最新评论