🦞 OpenClaw 日常高频命令速查表

发布于 2026年02月28日 23:24

#OpenClaw#CLI

openclaw 命令选项

#  openclaw 的版本,当前是`2026.3.2`
openclaw -v

# 查看`openclaw` 所有命令选项
openclaw --help

输出如下

Usage: openclaw [options] [command]

Options:
  --dev                Dev profile: isolate state under ~/.openclaw-dev, default gateway port 19001, and shift
                       derived ports (browser/canvas)
  -h, --help           Display help for command
  --log-level <level>  Global log level override for file + console (silent|fatal|error|warn|info|debug|trace)
  --no-color           Disable ANSI colors
  --profile <name>     Use a named profile (isolates OPENCLAW_STATE_DIR/OPENCLAW_CONFIG_PATH under
                       ~/.openclaw-<name>)
  -V, --version        output the version number

Commands:
  Hint: commands suffixed with * have subcommands. Run <command> --help for details.
  acp *                Agent Control Protocol tools
  agent                Run one agent turn via the Gateway
  agents *             Manage isolated agents (workspaces, auth, routing)
  approvals *          Manage exec approvals (gateway or node host)
  browser *            Manage OpenClaw's dedicated browser (Chrome/Chromium)
  channels *           Manage connected chat channels (Telegram, Discord, etc.)
  clawbot *            Legacy clawbot command aliases
  completion           Generate shell completion script
  config *             Non-interactive config helpers (get/set/unset/file/validate). Default: starts setup wizard.
  configure            Interactive setup wizard for credentials, channels, gateway, and agent defaults
  cron *               Manage cron jobs via the Gateway scheduler
  daemon *             Gateway service (legacy alias)
  dashboard            Open the Control UI with your current token
  devices *            Device pairing + token management
  directory *          Lookup contact and group IDs (self, peers, groups) for supported chat channels
  dns *                DNS helpers for wide-area discovery (Tailscale + CoreDNS)
  docs                 Search the live OpenClaw docs
  doctor               Health checks + quick fixes for the gateway and channels
  gateway *            Run, inspect, and query the WebSocket Gateway
  health               Fetch health from the running gateway
  help                 Display help for command
  hooks *              Manage internal agent hooks
  logs                 Tail gateway file logs via RPC
  memory *             Search and reindex memory files
  message *            Send, read, and manage messages
  models *             Discover, scan, and configure models
  node *               Run and manage the headless node host service
  nodes *              Manage gateway-owned node pairing and node commands
  onboard              Interactive onboarding wizard for gateway, workspace, and skills
  pairing *            Secure DM pairing (approve inbound requests)
  plugins *            Manage OpenClaw plugins and extensions
  qr                   Generate iOS pairing QR/setup code
  reset                Reset local config/state (keeps the CLI installed)
  sandbox *            Manage sandbox containers for agent isolation
  secrets *            Secrets runtime reload controls
  security *           Security tools and local config audits
  sessions *           List stored conversation sessions
  setup                Initialize local config and agent workspace
  skills *             List and inspect available skills
  status               Show channel health and recent session recipients
  system *             System events, heartbeat, and presence
  tui                  Open a terminal UI connected to the Gateway
  uninstall            Uninstall the gateway service + local data (CLI remains)
  update *             Update OpenClaw and inspect update channel status
  webhooks *           Webhook helpers and integrations

Examples:
  openclaw models --help
    Show detailed help for the models command.
  openclaw channels login --verbose
    Link personal WhatsApp Web and show QR + connection logs.
  openclaw message send --target +15555550123 --message "Hi" --json
    Send via your web session and print JSON result.
  openclaw gateway --port 18789
    Run the WebSocket Gateway locally.
  openclaw --dev gateway
    Run a dev Gateway (isolated state/config) on ws://127.0.0.1:19001.
  openclaw gateway --force
    Kill anything bound to the default gateway port, then start it.
  openclaw gateway ...
    Gateway control via WebSocket.
  openclaw agent --to +15555550123 --message "Run summary" --deliver
    Talk directly to the agent using the Gateway; optionally send the WhatsApp reply.
  openclaw message send --channel telegram --target @mychat --message "Hi"
    Send via your Telegram bot.

Docs: docs.openclaw.ai/cli

一、服务状态 & 运维

常用命令

分类命令作用备注
状态openclaw status查看整体运行状态⭐ 最常用
状态openclaw status —deep深度诊断排查网络/连接问题
日志openclaw logs查看最近日志
日志openclaw logs —follow实时日志⭐ 排错必备
重启openclaw restart重启所有服务
重启openclaw gateway restart只重启 gateway

二、设备管理(Node / Operator)

# 查看`openclaw devices` 所有命令选项
openclaw devices --help

官方输出

Usage: openclaw devices [options] [command]

Device pairing and auth tokens

Options:
  -h, --help  Display help for command

Commands:
  approve     Approve a pending device pairing request
  clear       Clear paired devices from the gateway table
  help        Display help for command
  list        List pending and paired devices
  reject      Reject a pending device pairing request
  remove      Remove a paired device entry
  revoke      Revoke a device token for a role
  rotate      Rotate a device token for a role

常用命令

分类命令作用典型场景
查看设备openclaw devices list查看已配对 / 待批准设备安装过程
批准设备openclaw devices approve 批准 Node 请求新机器接入
移除设备openclaw devices revoke 取消设备权限安全管理

三、飞书 / 渠道管理

分类命令作用典型场景
查看渠道openclaw channels list查看渠道状态安装过程
批准飞书用户openclaw pairing approve feishu <code>批准飞书用户配对飞书提示 pairing code 时
日志排查openclaw logs —follow查看是否收到消息看是否有 received message

四、Agent & 会话管理

# 查看 openclaw sessions 的命令所有选项
openclaw sessions --help

官方输出

Usage: openclaw sessions [options] [command]

List stored conversation sessions

Options:
  --active <minutes>  Only show sessions updated within the past N minutes
  --agent <id>        Agent id to inspect (default: configured default agent)
  --all-agents        Aggregate sessions across all configured agents (default: false)
  -h, --help          Display help for command
  --json              Output as JSON (default: false)
  --store <path>      Path to session store (default: resolved from config)
  --verbose           Verbose logging (default: false)

Commands:
  cleanup             Run session-store maintenance now

Examples:
  openclaw sessions
    List all sessions.
  openclaw sessions --agent work
    List sessions for one agent.
  openclaw sessions --all-agents
    Aggregate sessions across agents.
  openclaw sessions --active 120
    Only last 2 hours.
  openclaw sessions --json
    Machine-readable output.
  openclaw sessions --store ./tmp/sessions.json
    Use a specific session store.

Shows token usage per session when the agent reports it; set agents.defaults.contextTokens to cap the window and show %.

Docs: docs.openclaw.ai/cli/sessions

常用命令

分类命令作用
查看 Agentopenclaw agents list查看已加载 Agent
查看会话openclaw sessions查看当前会话列表

五、配置管理

# 查看 openclaw config 的命令所有选项
openclaw config --help

官方输出

Usage: openclaw config [options] [command]

Non-interactive config helpers (get/set/unset/file/validate). Run without subcommand for the setup wizard.

Options:
  -h, --help           Display help for command
  --section <section>  Configure wizard sections (repeatable). Use with no subcommand. (default: [])

Commands:
  file                 Print the active config file path
  get                  Get a config value by dot path
  set                  Set a config value by dot path
  unset                Remove a config value by dot path
  validate             Validate the current config against the schema without starting the gateway

Docs: docs.openclaw.ai/cli/config

常用命令

常用命令

分类命令作用示例
查看配置openclaw config get 查看某项配置openclaw config get gateway.port
修改配置openclaw config set 修改配置openclaw config set gateway.port 18800
导出配置openclaw config export查看完整配置

六、安全审计

# 查看 openclaw security 的命令所有选项
openclaw security --help

官方输出

Audit local config and state for common security foot-guns

Options:
  -h, --help  Display help for command

Commands:
  audit       Audit config + local state for common security foot-guns
  help        Display help for command

Examples:
  openclaw security audit
    Run a local security audit.
  openclaw security audit --deep
    Include best-effort live Gateway probe checks.
  openclaw security audit --fix
    Apply safe remediations and file-permission fixes.
  openclaw security audit --json
    Output machine-readable JSON.

Docs: docs.openclaw.ai/cli/security

常用命令

分类命令作用
安全检查openclaw security audit快速安全检查
深度检查openclaw security audit —deep深度安全扫描

七、版本 & 更新

常用命令

分类命令作用
查看版本openclaw —version当前版本
更新 (pnpm)pnpm update -g openclaw更新到最新版本
更新 (npm)npm update -g openclaw更新到最新版本

评论互动

© 2026 王若风的技术博客 · Powered by Astro