WSL准备

搭建时使用WSL2,预期通过宿主机访问虚拟机的OpenClaw,通过虚拟机OpenClaw操作生成文档等,以及自动创建项目生成代码

需支持hyper-v,安装wsl2

安装环境为ubuntu22.04

部署

安装nmv

1
2
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.6/install.sh | bash
source ~/.bashrc

安装node.js

1
2
3
nvm install 22
nvm use 22
node -v

安装OpenClaw

1
curl -fsSL https://openclaw.ai/install.sh | bash

OpenClaw终端常用命令

常见指令集

检查服务状态

1
openclaw status

运行配置向导

1
openclaw onboard 

查看控制台

1
openclaw dashboard

配置其他模型(deepseek示例)

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
openclaw config set models.providers.deepseek '{
"baseUrl": "https://api.deepseek.com/v1",
"apiKey": "你的API_KEY",
"api": "openai-completions",
"models": [
{
"id": "deepseek-chat",
"name": "DeepSeek Chat (V3)"
},
{
"id": "deepseek-reasoner",
"name": "DeepSeek Reasoner (R1)"
}
]
}'

查看可用模型列表

1
openclaw models list --all

设置默认模型

1
openclaw config set agents.defaults.model.primary "deepseek/deepseek-chat"

基础指令集

命令 说明 语法 示例
查看版本 查看当前 OpenClaw 的安装版本 openclaw –version openclaw –version
查看帮助 查看所有 CLI 命令的帮助信息 openclaw –help openclaw –help
状态概览 查看 OpenClaw 的整体状态,包括 Gateway、模型、频道等信息 openclaw status openclaw status
完整诊断 查看详细的状态信息,适合调试和分享 openclaw status –all openclaw status –all
健康检查 检查系统的健康状态,检测潜在问题 openclaw health openclaw health
深度健康检查 进行更全面的健康检测,排查深层问题 openclaw status –deep openclaw status –deep

网关指令集

命令 说明 语法 示例
启动 Gateway 启动 Gateway 服务 openclaw gateway start openclaw gateway start
停止 Gateway 停止 Gateway 服务 openclaw gateway stop openclaw gateway stop
重启 Gateway 重启 Gateway 服务 openclaw gateway restart openclaw gateway restart
查看 Gateway 状态 查看 Gateway 的运行状态 openclaw gateway status openclaw gateway status
前台运行 Gateway 手动在前台运行 Gateway,用于调试,显示详细日志 openclaw gateway –port <端口> –verbose openclaw gateway –port 18789 –verbose
设置绑定模式 指定 Gateway 的网络绑定模式,控制访问范围 openclaw gateway –bind <模式> openclaw gateway –bind loopback(本地回环,默认)openclaw gateway –bind lan(局域网)openclaw gateway –bind tailnet(Tailscale 网络

配置指令集

命令 说明 语法 示例
交互式配置 进入交互式配置向导,逐步设置系统参数 openclaw configure openclaw configure
查看完整配置 查看当前的所有配置信息 openclaw config get openclaw config get
查看特定配置 查看指定部分的配置信息 openclaw config get <配置路径> openclaw config get agents.defaultsopenclaw config get channels.telegram
设置配置值 设置指定配置项的值 openclaw config set <配置路径> <值> openclaw config set gateway.port 18789openclaw config set agents.defaults.workspace ~/.openclaw/workspace
删除配置项 删除指定的配置项 openclaw config unset <配置路径> openclaw config unset gateway.port
查看配置文件位置 配置文件默认路径:~/.openclaw/openclaw.json - -

模型管理指令集

命令 说明 语法 示例
查看可用模型 列出所有支持的 AI 模型 openclaw models list openclaw models list
查看模型状态 查看已配置模型的状态,包括 API Key 有效性等 openclaw models status openclaw models status
扫描可用模型 扫描系统中可用的 AI 模型 openclaw models scan openclaw models scan
设置默认模型 设置默认使用的 AI 模型 openclaw models set <模型名> openclaw models set anthropic/claude-sonnet-4-0
测试模型连接 测试指定模型的连接是否正常 openclaw models probe <模型名> openclaw models probe claude-opus-4-5

频道管理指令集

命令 说明 语法 示例
频道登录 登录指定的即时通讯频道,如 WhatsApp(需要扫描二维码) openclaw channels login openclaw channels login
频道登出 退出登录的频道 openclaw channels logout openclaw channels logout
查看频道状态 查看所有已配置频道的状态 openclaw channels status openclaw channels status
探测频道连通性 测试频道的连通性,检查是否可以正常使用 openclaw channels status –probe openclaw channels status –probe

配对管理指令集

命令 说明 语法 示例
查看待处理配对 查看指定频道的待处理配对请求 openclaw pairing list <频道名> openclaw pairing list whatsappopenclaw pairing list telegram
批准配对 批准指定的配对请求,允许用户和 OpenClaw 交互 openclaw pairing approve <频道名> <配对码> openclaw pairing approve whatsapp ABC123
拒绝配对 拒绝指定的配对请求 openclaw pairing deny <频道名> <配对码> openclaw pairing deny telegram XYZ789

消息发送指令集

命令 说明 语法 示例
发送文本消息 向指定目标发送文本消息 openclaw message send –target <目标> –message <消息内容> openclaw message send –target +15555550123 –message “Hello from OpenClaw”
发送文件 向指定目标发送文件 openclaw message send –target <目标> –file <文件路径> openclaw message send –target +15555550123 –file /path/to/file.txt

代理(agent)指令集

命令 说明 语法 示例
查看代理列表 列出所有已创建的代理 openclaw agents list openclaw agents list
添加新代理 创建新的代理实例,指定工作区 openclaw agents add <代理名> –workspace <工作区路径> openclaw agents add work –workspace ~/.openclaw/work
查看代理状态 查看指定代理的状态 openclaw agents status <代理名> openclaw agents status work

会话指令集

命令 说明 语法 示例
查看活跃会话 列出当前活跃的聊天会话 openclaw sessions list openclaw sessions list
查看会话历史 查看指定会话的聊天历史 openclaw sessions history <会话ID> openclaw sessions history session-123
重置会话 重置指定的会话,清空历史记录 openclaw sessions reset <会话ID> openclaw sessions reset session-123

技能指令集

命令 说明 语法 示例
列出已安装技能 查看所有已安装的技能 openclaw skills list openclaw skills list
安装技能 安装指定的技能 openclaw skills install <技能名> openclaw skills install weather
查看技能配置 查看指定技能的配置信息 openclaw skills config <技能名> openclaw skills config weather
更新技能 更新指定的技能到最新版本 openclaw skills update <技能名> openclaw skills update weather

日志、诊断指令集

命令 说明 语法 示例
实时查看日志 实时跟踪 Gateway 的日志输出 openclaw logs –follow openclaw logs –follow
查看最近日志 查看最近指定行数的日志 openclaw logs –limit <行数> openclaw logs –limit 100
诊断和修复 自动诊断系统问题并尝试修复 openclaw doctor openclaw doctoropenclaw doctor –fix(自动修复)

更新升级

命令 说明 语法 示例
检查更新 查看当前版本和最新版本信息 openclaw –version openclaw –version
自动更新 通过官方安装脚本更新 OpenClaw curl -fsSL https://openclaw.ai/install.sh | bash curl -fsSL https://openclaw.ai/install.sh | bash
从源码更新 如果从源码安装,通过 git 更新 git pull origin main && pnpm install && pnpm build git pull origin main && pnpm install && pnpm build

安全相关

命令 说明 语法 示例
安全审计 审计系统的安全配置,检测潜在风险 openclaw security audit openclaw security audit
深度安全审计 进行更全面的安全审计 openclaw security audit –deep openclaw security audit –deep

OpenClaw聊天常用命令

基础命令

命令 说明 语法 示例
新开对话 重置当前会话,清空历史记录,节省 Token 消耗 /new /new
新开对话并切换模型 重置会话并切换到指定模型 /new <模型名> /new haiku/new claude-sonnet-4-5
查看会话状态 查看当前会话的状态,包括模型、Token 使用量、预估成本 /status /status
查看帮助 查看所有斜杠命令的帮助信息 /help /help
查看命令列表 查看所有可用的斜杠命令 /commands /commands

模型和上下文

命令 说明 语法 示例
切换模型 切换当前会话使用的 AI 模型 /model <模型名> /model haiku/model opus/model claude-opus-4-5
查看可用模型 列出所有可用的 AI 模型 /model list /model list
查看模型状态 查看当前使用的模型的详细状态 /model status /model status
压缩上下文 将历史对话压缩成摘要,减少 Token 消耗,同时保留关键信息 /compact /compact
带指令压缩上下文 指定压缩规则,告诉 AI 保留哪些信息 /compact <压缩指令> /compact 保留代码相关的讨论,其他可以简化
查看用量 控制 Token 和成本的显示方式 /usage <模式> /usage off(关闭用量显示)/usage tokens(只显示 Token 数量)/usage full(显示完整用量详情)/usage cost(显示成本统计)
查看上下文详情 查看当前上下文的详细信息,包括 Token 分布 /context /context/context list(列出上下文组件)/context detail(显示详细 Token 分布)/context json(JSON 格式输出)

命令控制

命令 说明 语法 示例
执行控制 控制 OpenClaw 执行系统命令的权限和方式 /exec /exec(查看当前设置)/exec host=<sandbox | gateway | node>(设置执行主机)
/exec security=<deny | allowlist>
批准操作 批准 OpenClaw 需要权限的操作 /approve <操作ID> <权限> /approve abc123 allow-once(允许本次操作)/approve abc123 allow-always(永久允许此类操作)/approve abc123 deny(拒绝操作)
提升权限模式 控制是否需要频繁确认操作 /elevated <模式> /elevated on(启用提升权限,减少询问)/elevated full(完全跳过询问,谨慎使用)/elevated off(关闭提升权限)

语音和子代理

命令 说明 语法 示例
语音合成控制 控制 TTS(文本转语音)功能 /tts <模式> /tts off(关闭语音合成)/tts always(所有回复都用语音播放)/tts inbound(仅对语音输入的回复用语音播放)/tts tagged(仅播放标记的内容)/tts status(查看当前 TTS 状态)/tts provider(查看或切换 TTS 提供商)
子代理管理 管理后台运行的子代理,处理并行任务 /subagents <操作> /subagents list(列出所有子代理)/subagents stop <代理ID>(停止指定子代理)/subagents log <代理ID>(查看子代理日志)/subagents info <代理ID>(查看子代理详情)/subagents send <代理ID> <消息>(向子代理发送消息)

常用命令速查

场景 推荐命令
日常状态检查 openclaw status、/status
启动 / 停止服务 openclaw gateway start、openclaw gateway stop
切换模型 /model haiku、/model opus
节省 Token /new、/compact
成本监控 /usage full、openclaw status –all
调试问题 openclaw logs –follow、openclaw doctor
批准用户配对 openclaw pairing approve <频道> <配对码>

附件

docs.openclaw.ai-OpenClaw Docs