#Phụ lục A: Bảng mã lệnh
OpenClaw cung cấp rất nhiều công cụ dòng lệnh. Phụ lục này tổ chức tất cả các lệnh thường được sử dụng dựa trên tài liệu chính thức.
Nguồn tham khảo: OpenClaw CLI Reference
Điều hướng nhanh
Tùy chọn toàn cầu
bash
openclaw [--dev] [--profile <name>] <command>
--dev # 隔离状态到 ~/.openclaw-dev,并偏移默认端口
--profile <name> # 隔离状态到 ~/.openclaw-<name>
--no-color # 禁用 ANSI 颜色
--update # 简写为 openclaw update(仅源码安装)
-V, --version, -v # 打印版本并退出Cài đặt và cập nhật
Cài đặt OpenClaw
bash
# 通过 npm 安装(推荐)
npm install -g openclaw@latest
# 或通过 pnpm
pnpm add -g openclaw@latestCập nhật OpenClaw
bash
# 检查并更新到最新版本
openclaw update
# 切换到特定频道
openclaw update --channel stable|beta|dev
# 查看当前版本
openclaw --versionGỡ cài đặt OpenClaw
bash
# 卸载网关服务和本地数据(CLI 保留)
openclaw uninstall
# 指定范围卸载
openclaw uninstall --service --state --workspace --app --all
# 重置配置和状态(保留 CLI)
openclaw reset
openclaw reset --scope config+creds+sessions --yesKhởi tạo và cấu hình
Trình hướng dẫn khởi tạo
bash
# 交互式设置向导(推荐)
openclaw onboard
# 初始化并安装守护进程
openclaw onboard --install-daemon
# 非交互式模式
openclaw onboard --non-interactive --mode local
# 重置后重新初始化
openclaw onboard --resetTrình hướng dẫn cấu hình
bash
# 交互式配置向导
openclaw configure
# 验证配置
openclaw doctor
openclaw doctor --fix # 自动修复
openclaw doctor --deep # 深度扫描Mở bảng điều khiển
bash
# 启动 Web Dashboard
openclaw dashboardQuản lý cổng
Gateway là dịch vụ cốt lõi của OpenClaw và chạy ở địa chỉ ws://127.0.0.1:18789 theo mặc định.
Cổng khởi động
bash
# 前台运行(调试模式)
openclaw gateway --port 18789 --verbose
# 指定绑定地址
openclaw gateway --bind loopback|lan|tailnet|auto|custom
# 使用 Token 认证
openclaw gateway --auth token --token <token>
# 使用密码认证
openclaw gateway --auth password --password <password>
# Tailscale 集成
openclaw gateway --tailscale serve|funnel
# 开发模式
openclaw gateway --devQuản lý dịch vụ cổng
bash
# 查看网关服务状态
openclaw gateway status
# 安装为系统服务
openclaw gateway install
# 卸载服务
openclaw gateway uninstall
# 启动/停止/重启服务
openclaw gateway start
openclaw gateway stop
openclaw gateway restart
# 查看日志
openclaw logs
openclaw logs --limit 100Kiểm tra tình trạng cổng
bash
# 获取网关健康状态
openclaw health
openclaw health --json
openclaw health --verbose
# 网关调用(RPC)
openclaw gateway call <method> --params '<json>'Quản lý đại lý
Liệt kê tất cả Đại lý
bash
openclaw agents list
openclaw agents list --json
openclaw agents list --bindingsThêm đại lý
bash
# 交互式添加
openclaw agents add
# 指定名称添加
openclaw agents add [name]
# 非交互式添加
openclaw agents add my-agent \
--workspace ~/.openclaw/workspace-my-agent \
--model anthropic/claude-sonnet-4-5 \
--bind whatsapp:personal \
--non-interactiveQuản lý ràng buộc
bash
# 查看绑定
openclaw agents bindings
openclaw agents bindings --agent <id>
# 添加绑定
openclaw agents bind --agent <id> --bind <channel[:accountId]>
# 移除绑定
openclaw agents unbind --agent <id> --bind <channel[:accountId]>
openclaw agents unbind --agent <id> --allXóa tác nhân
bash
openclaw agents delete <id>
openclaw agents delete <id> --forceChạy đại lý
bash
# 单次对话
openclaw agent --message "Hello" --to <dest>
# 指定会话
openclaw agent --message "Hello" --session-id <id>
# 指定思考级别
openclaw agent --message "Hello" --thinking high
# 本地模式(不通过网关)
openclaw agent --message "Hello" --local
# 指定渠道回复
openclaw agent --message "Hello" --channel whatsapp --deliverQuản lý kỹ năng
Liệt kê các kỹ năng
bash
openclaw skills list
openclaw skills list --eligible # 仅显示就绪技能
openclaw skills list --json
openclaw skills list -v # 显示缺失需求详情Xem chi tiết kỹ năng
bash
openclaw skills info <name>Kiểm tra trạng thái kỹ năng
bash
openclaw skills checkMẹo: Sử dụng
npx clawhubđể tìm kiếm, cài đặt và đồng bộ kỹ năng.
Quản lý trình cắm
Liệt kê các plugin
bash
openclaw plugins list
openclaw plugins list --jsonXem chi tiết plugin
bash
openclaw plugins info <id>Cài đặt plugin
bash
openclaw plugins install <path|.tgz|npm-spec>Bật/tắt plugin
bash
openclaw plugins enable <id>
openclaw plugins disable <id>Chẩn đoán trình cắm
bash
openclaw plugins doctorQuản lý bộ nhớ
Xem trạng thái bộ nhớ
bash
openclaw memory statusBộ nhớ chỉ mục
bash
openclaw memory indexBộ nhớ tìm kiếm
bash
openclaw memory search "<query>"
openclaw memory search --query "<query>"Quản lý thiết bị
Liệt kê các thiết bị
bash
openclaw devices list
openclaw devices list --jsonThiết bị phê duyệt
bash
openclaw devices approve [requestId]
openclaw devices approve --latestTừ chối thiết bị
bash
openclaw devices reject <requestId>Xóa thiết bị
bash
openclaw devices remove <deviceId>Xóa thiết bị
bash
openclaw devices clear --yes
openclaw devices clear --yes --pendingQuản lý ghép nối
Liệt kê các yêu cầu ghép nối
bash
openclaw pairing list
openclaw pairing list [channel] --channel <channel> --account <id>Phê duyệt ghép nối
bash
openclaw pairing approve <channel> <code>
openclaw pairing approve --channel <channel> <code> --notifyQuản lý kênh
Liệt kê các kênh
bash
openclaw channels list
openclaw channels list --jsonKiểm tra trạng thái kênh
bash
openclaw channels status
openclaw channels status --probeXem nhật ký kênh
bash
openclaw channels logs
openclaw channels logs --channel <name> --limit 200Thêm kênh
bash
# 交互式添加
openclaw channels add
# 非交互式添加 Telegram
openclaw channels add \
--channel telegram \
--account alerts \
--name "Alerts Bot" \
--token $TELEGRAM_BOT_TOKEN
# 非交互式添加 Discord
openclaw channels add \
--channel discord \
--account work \
--name "Work Bot" \
--token $DISCORD_BOT_TOKENXóa kênh
bash
openclaw channels remove --channel <channel> --account <id>
openclaw channels remove --channel <channel> --account <id> --deleteĐăng nhập/Đăng xuất
bash
# WhatsApp Web 登录
openclaw channels login
openclaw channels login --channel whatsapp --account <id> --verbose
# 登出
openclaw channels logout
openclaw channels logout --channel <channel> --account <id>Gửi tin nhắn
Gửi tin nhắn
bash
openclaw message send --target +15555550123 --message "Hello"Gửi phiếu bầu
bash
openclaw message poll \
--channel discord \
--target channel:123 \
--poll-question "Snack?" \
--poll-option Pizza \
--poll-option SushiCác thao tác nhắn tin khác
bash
openclaw message react
openclaw message reactions
openclaw message read
openclaw message edit
openclaw message delete
openclaw message pin
openclaw message unpin##Quản lý mô hình
Danh sách mô hình
bash
openclaw models list
openclaw models statusThiết lập mô hình
bash
openclaw models set <model>
openclaw models set-image <model>Bí danh mẫu
bash
openclaw models aliases list
openclaw models aliases add <alias> <model>
openclaw models aliases remove <alias>Khôi phục mô hình
bash
openclaw models fallbacks list
openclaw models fallbacks add <model>
openclaw models fallbacks remove <model>
openclaw models fallbacks clearChứng nhận mẫu
bash
openclaw models auth add
openclaw models auth setup-token
openclaw models auth paste-token
openclaw models auth order get|set|clearThao tác cấu hình
Nhận cấu hình
bash
openclaw config get <path>
openclaw config get agents.defaults.workspaceĐặt cấu hình
bash
openclaw config set <path> <value>
openclaw config set agents.defaults.heartbeat.every "2h"Xóa cấu hình
bash
openclaw config unset <path>Đường dẫn file cấu hình
bash
openclaw config fileXác minh cấu hình
bash
openclaw config validate
openclaw config validate --json##Quản lý hệ thống
Sự kiện hệ thống
bash
openclaw system eventQuản lý nhịp tim
bash
openclaw system heartbeat last
openclaw system heartbeat enable
openclaw system heartbeat disableTrạng thái trực tuyến
bash
openclaw system presenceQuản lý bảo mật
Kiểm tra bảo mật
bash
openclaw security audit
openclaw security audit --deep
openclaw security audit --fixQuản lý khóa
bash
openclaw secrets reload
openclaw secrets audit
openclaw secrets configure
openclaw secrets apply --from <plan.json>Quản lý phiên
Liệt kê các phiên
bash
openclaw sessions list
openclaw sessions --json
openclaw sessions --verboseKiểm tra trạng thái
bash
openclaw status
openclaw status --json
openclaw status --deep
openclaw status --usageQuản lý trình duyệt
bash
openclaw browser status
openclaw browser start
openclaw browser stop
openclaw browser reset-profile
openclaw browser tabs
openclaw browser open <url>
openclaw browser screenshot
openclaw browser navigate <url>Nhiệm vụ theo lịch trình
bash
openclaw cron status
openclaw cron list
openclaw cron add
openclaw cron edit <id>
openclaw cron rm <id>
openclaw cron enable <id>
openclaw cron disable <id>
openclaw cron runs
openclaw cron run <id>Bí danh lệnh tắt
Để nâng cao hiệu quả, bạn có thể đặt bí danh cho các lệnh thường dùng:
bash
# 添加到 ~/.bashrc 或 ~/.zshrc
alias oc='openclaw'
alias ocg='openclaw gateway'
alias ocs='openclaw skills'
alias oca='openclaw agents'
alias ocd='openclaw dashboard'
alias ocdr='openclaw doctor'
alias occh='openclaw channels'
# 快速启动别名
alias ocstart='openclaw gateway start && openclaw dashboard'
alias ocstop='openclaw gateway stop'
alias ocrestart='openclaw gateway restart'Kiểm tra nhanh sự cố
| Vấn đề | Lệnh chẩn đoán | Giải pháp |
|---|---|---|
| Cổng không thể khởi động được | openclaw doctor | Kiểm tra tỷ lệ sử dụng cổng và xem nhật ký |
| Không thể truy cập bảng điều khiển | openclaw gateway status | Xác nhận rằng cổng đang chạy và kiểm tra tường lửa |
| Kết nối kênh không thành công | openclaw channels status --probe | Kiểm tra cấu hình và xác thực kênh |
| Kết nối mô hình không thành công | openclaw models status | Xác minh cấu hình mô hình và khóa API |
| Ghép nối thiết bị không thành công | openclaw devices list | Phê duyệt thiết bị đang chờ xử lý |
| Xác minh cấu hình không thành công | openclaw config validate | Sửa chữa cấu hình theo thông báo lỗi |
Trợ giúp thêm
bash
# 查看全局帮助
openclaw --help
# 查看子命令帮助
openclaw <command> --help
# 查看具体命令帮助
openclaw gateway --help
openclaw channels add --helpMẹo: Bảng cheat này dựa trên tài liệu chính thức của OpenClaw. Bạn nên truy cập docs.openclaw.ai để biết thông tin mới nhất.