ANALYSIS
OpenClaw 命令行工具速查手册
概述
OpenClaw 提供了丰富的命令行工具,方便用户快速配置、管理和使用 AI 助手。本文档整理了最常用的 CLI 命令和斜杠命令,帮助你高效地操作 OpenClaw。
CLI 命令
查看帮助
PRTCL // BASH
# 查看所有可用命令openclaw --help
# 查看特定命令的帮助openclaw <command> --help
# 查看版本信息openclaw --version初始化配置
PRTCL // BASH
# 启动配置向导openclaw onboard
# 初始化配置文件openclaw init
# 验证配置openclaw config validate服务管理
PRTCL // BASH
# 启动 OpenClaw 服务openclaw start
# 停止 OpenClaw 服务openclaw stop
# 重启 OpenClaw 服务openclaw restart
# 查看服务状态openclaw status
# 查看服务日志openclaw logs
# 实时查看日志openclaw logs -fAgent 管理
PRTCL // BASH
# 列出所有 Agentopenclaw agent list
# 查看特定 Agent 信息openclaw agent info <agent-id>
# 创建新 Agentopenclaw agent create <name>
# 删除 Agentopenclaw agent delete <agent-id>
# 启用 Agentopenclaw agent enable <agent-id>
# 禁用 Agentopenclaw agent disable <agent-id>
# 重新加载 Agent 配置openclaw agent reload技能管理
PRTCL // BASH
# 列出已安装的技能openclaw skill list
# 安装技能openclaw skill install <skill-name>
# 卸载技能openclaw skill uninstall <skill-name>
# 更新技能openclaw skill update <skill-name>
# 搜索技能openclaw skill search <keyword>渠道管理
PRTCL // BASH
# 列出所有渠道openclaw channel list
# 查看渠道状态openclaw channel status <channel-name>
# 添加渠道openclaw channel add <channel-name>
# 删除渠道openclaw channel remove <channel-name>
# 测试渠道连接openclaw channel test <channel-name>工作流管理
PRTCL // BASH
# 列出所有工作流openclaw workflow list
# 执行工作流openclaw workflow run <workflow-id>
# 查看工作流状态openclaw workflow status <execution-id>
# 暂停工作流openclaw workflow pause <execution-id>
# 恢复工作流openclaw workflow resume <execution-id>
# 取消工作流openclaw workflow cancel <execution-id>
# 查看工作流日志openclaw workflow logs <execution-id>模型管理
PRTCL // BASH
# 列出可用模型openclaw model list
# 设置默认模型openclaw model default <model-id>
# 添加模型提供商openclaw model provider add <provider-name>
# 移除模型提供商openclaw model provider remove <provider-name>
# 测试模型连接openclaw model test <model-id>配置管理
PRTCL // BASH
# 查看当前配置openclaw config show
# 编辑配置openclaw config edit
# 导出配置openclaw config export <output-file>
# 导入配置openclaw config import <input-file>
# 重置配置openclaw config reset数据管理
PRTCL // BASH
# 查看数据目录openclaw data dir
# 备份数据openclaw data backup <backup-path>
# 恢复数据openclaw data restore <backup-path>
# 清理缓存openclaw data clear-cache
# 查看数据大小openclaw data size诊断工具
PRTCL // BASH
# 运行诊断openclaw diagnose
# 健康检查openclaw health
# 查看系统信息openclaw info
# 生成诊断报告openclaw report generate斜杠命令(聊天中)
斜杠命令可以在 OpenClaw 的聊天界面中使用,用于快速执行特定操作。
帮助命令
PRTCL // PLAINTEXT
/help # 显示帮助信息/commands # 列出所有可用命令/about # 关于 OpenClaw会话管理
PRTCL // PLAINTEXT
/clear # 清除当前对话历史/new # 开始新的对话/history # 查看对话历史/export # 导出对话内容/reset # 重置 Agent 状态Agent 操作
PRTCL // PLAINTEXT
/agent list # 列出可用 Agent/agent switch <name> # 切换到指定 Agent/agent info # 查看当前 Agent 信息/agent reset # 重置当前 Agent技能操作
PRTCL // PLAINTEXT
/skill list # 列出可用技能/skill use <name> # 使用指定技能/skill info <name> # 查看技能信息工作流操作
PRTCL // PLAINTEXT
/workflow list # 列出可用工作流/workflow run <name> # 运行工作流/workflow status # 查看工作流状态配置操作
PRTCL // PLAINTEXT
/config show # 显示当前配置/config model <model> # 切换模型/config temp <value> # 设置温度参数/config max <value> # 设置最大 Token 数文件操作
PRTCL // PLAINTEXT
/file list # 列出可访问的文件/file read <path> # 读取文件内容/file write <path> # 写入文件内容/file delete <path> # 删除文件工具操作
PRTCL // PLAINTEXT
/tool list # 列出可用工具/tool use <name> # 使用指定工具/tool search <keyword> # 搜索工具任务管理
PRTCL // PLAINTEXT
/task list # 列出运行中的任务/task stop <id> # 停止指定任务/task status <id> # 查看任务状态记忆操作
PRTCL // PLAINTEXT
/memory save # 保存当前对话到记忆/memory recall # 检索相关记忆/memory clear # 清除记忆/memory search <query> # 搜索记忆常用组合命令
快速重启服务
PRTCL // BASH
# 停止并重新启动openclaw stop && openclaw start
# 重启并查看日志openclaw restart && openclaw logs -f批量更新技能
PRTCL // BASH
# 更新所有已安装的技能openclaw skill list | awk '{print $1}' | xargs -I {} openclaw skill update {}配置备份
PRTCL // BASH
# 创建配置备份openclaw config export backup-$(date +%Y%m%d).yaml
# 备份完整数据openclaw data backup backup-$(date +%Y%m%d).tar.gz健康检查
PRTCL // BASH
# 全面健康检查openclaw health && openclaw diagnose清理和优化
PRTCL // BASH
# 清理缓存和日志openclaw data clear-cache
# 清理旧备份find ~/.openclaw/backups -name "*.tar.gz" -mtime +30 -delete环境变量
OpenClaw 支持通过环境变量进行配置。
通用配置
PRTCL // BASH
# API Keyexport OPENCLAW_API_KEY="your-api-key"
# API 端点export OPENCLAW_API_ENDPOINT="https://api.openclaw.ai"
# 配置目录export OPENCLAW_CONFIG_DIR="~/.openclaw"
# 数据目录export OPENCLAW_DATA_DIR="~/.openclaw/data"模型配置
PRTCL // BASH
# 默认模型export OPENCLAW_DEFAULT_MODEL="gpt-4o-mini"
# 温度参数export OPENCLAW_TEMPERATURE=0.7
# 最大 Token 数export OPENCLAW_MAX_TOKENS=2000日志配置
PRTCL // BASH
# 日志级别export OPENCLAW_LOG_LEVEL="info"
# 日志文件export OPENCLAW_LOG_FILE="~/.openclaw/logs/openclaw.log"网络配置
PRTCL // BASH
# 代理设置export HTTP_PROXY="http://proxy.example.com:8080"export HTTPS_PROXY="http://proxy.example.com:8080"
# 超时设置export OPENCLAW_TIMEOUT=30快捷键
终端快捷键
PRTCL // PLAINTEXT
Ctrl + C # 停止当前命令Ctrl + Z # 暂停当前命令Ctrl + D # 退出会话Ctrl + L # 清屏Ctrl + A # 移动到行首Ctrl + E # 移动到行尾Ctrl + U # 删除到行首Ctrl + K # 删除到行尾聊天界面快捷键
PRTCL // PLAINTEXT
Ctrl + Enter # 发送消息Ctrl + C # 取消输入Ctrl + L # 清屏↑ / ↓ # 浏览历史命令Tab # 自动补全故障排查命令
连接问题
PRTCL // BASH
# 测试 API 连接openclaw model test
# 检查网络连接curl -I https://api.openclaw.ai
# 查看端口占用netstat -ano | findstr :3000 # Windowslsof -i :3000 # Linux/macOS性能问题
PRTCL // BASH
# 查看资源使用openclaw info
# 查看性能指标openclaw diagnose
# 查看详细日志openclaw logs -f --level=debug配置问题
PRTCL // BASH
# 验证配置openclaw config validate
# 查看当前配置openclaw config show
# 重置配置openclaw config reset最佳实践
日常使用
- 定期备份:每周备份一次配置和数据
- 监控日志:定期检查日志文件,及时发现异常
- 更新维护:及时更新 OpenClaw 和技能到最新版本
性能优化
- 清理缓存:定期清理缓存释放空间
- 调整参数:根据实际需求调整温度和 Token 限制
- 选择模型:根据任务复杂度选择合适的模型
安全建议
- 保护密钥:不要将 API Key 提交到版本控制
- 使用环境变量:敏感信息使用环境变量存储
- 限制访问:配置适当的权限和访问控制
常见问题
Q: 如何查看所有可用命令?
PRTCL // BASH
# CLI 命令openclaw --help
# 聊天斜杠命令/help 或 /commandsQ: 命令执行失败怎么办?
PRTCL // BASH
# 查看详细错误信息openclaw logs -f
# 运行诊断openclaw diagnose
# 验证配置openclaw config validateQ: 如何更新 OpenClaw?
PRTCL // BASH
# 使用包管理器更新npm update -g openclaw
# 或重新安装最新版本npm install -g openclaw@latestQ: 如何卸载 OpenClaw?
PRTCL // BASH
# 卸载程序npm uninstall -g openclaw
# 删除配置和数据rm -rf ~/.openclaw资源链接
- 官方文档: https://docs.openclaw.ai/cli
- GitHub 仓库: https://github.com/openclaw/openclaw
- 社区支持: https://community.openclaw.ai
最后更新: 2026-03-12 作者: EchoHaoRan
R P
Rhine Lab Pioneer Division
Auth_Verified: 2026.04.08
Auth_Verified: 2026.04.08
