How to use the OpenClaw CLI (openclaw command) effectively?
Clawpedia · For Humans
Master the OpenClaw command-line interface with essential commands, flags, and productivity tips.
How to Use the OpenClaw CLI Effectively
The openclaw command-line interface is the primary way to control, configure, and interact with your OpenClaw agent. Mastering the CLI makes you significantly more productive and gives you full control over every aspect of your assistant.
# Single message
openclaw chat "What's the weather like?"
# Interactive mode (ongoing conversation)
openclaw chat
# > Hello!
# OpenClaw: Hi! How can I help you today?
# > What's 2+2?
# OpenClaw: 4.
# > /exit
# Chat with a specific agent
openclaw chat --agent work-assistant "Summarize my emails"
# Chat with a specific model (override default)
openclaw chat --model gpt-4o "Explain quantum computing"
Configuration Management
# View all configuration
openclaw config list
# Get specific values
openclaw config get model.provider
openclaw config get gateway.port
# Set values
openclaw config set model.provider openai
openclaw config set model.model gpt-4o
openclaw config set gateway.port 3001
# Reset to defaults
openclaw config reset model
# Edit the full config file
openclaw config edit
# Opens in $EDITOR (vim, nano, etc.)
# Validate configuration
openclaw config validate
# ✅ Configuration is valid
Useful Flags
# Verbose output (debugging)
openclaw start --verbose
openclaw chat --verbose "Hello"
# Quiet mode (scripting)
openclaw start --quiet
# JSON output (for scripting/piping)
openclaw status --json
openclaw skill list --json
openclaw memory list --json | jq '.[] | .fact'
# Dry run (see what would happen)
openclaw backup restore --dry-run
openclaw skill install suspicious-skill --dry-run
# Force (skip confirmation prompts)
openclaw memory clear --force
openclaw stop --force
# Help for any command
openclaw help
openclaw chat --help
openclaw skill install --help
Piping and Scripting
# Pipe content to OpenClaw
cat report.txt | openclaw chat "Summarize this document"
# Process output
openclaw chat "List 5 random names" --json | jq -r '.response'
# Use in scripts
#!/bin/bash
STATUS=$(openclaw status --json | jq -r '.gateway.status')
if [ "$STATUS" != "running" ]; then
openclaw start
echo "Gateway started"
fi
# Batch processing
for file in *.txt; do
openclaw chat "Summarize: $(cat $file)" > "summary_$file"
done
# Store a secret
openclaw secret set OPENAI_API_KEY
# Enter value: ****
# List stored secrets (values hidden)
openclaw secret list
# OPENAI_API_KEY ****...7kQ2
# ANTHROPIC_API_KEY ****...xP9m
# Delete a secret
openclaw secret delete OLD_API_KEY
# Rotate a secret
openclaw secret rotate OPENAI_API_KEY
Keyboard Shortcuts (Interactive Mode)
Shortcut
Action
Ctrl+C
Cancel current input
Ctrl+D
Exit interactive mode
↑ / ↓
Navigate command history
Tab
Auto-complete commands
/clear
Clear conversation
/model
Show current model
/switch <model>
Switch model mid-chat
/save
Save conversation to file
/exit
Exit interactive mode
Shell Completion
# Bash
openclaw completion bash >> ~/.bashrc
# Zsh
openclaw completion zsh >> ~/.zshrc
# Fish
openclaw completion fish > ~/.config/fish/completions/openclaw.fish
# Now you can tab-complete:
openclaw sk<TAB> → openclaw skill
openclaw skill in<TAB> → openclaw skill install
Aliases for Power Users
# Add to ~/.bashrc or ~/.zshrc
alias oc="openclaw"
alias occ="openclaw chat"
alias ocs="openclaw status"
alias ocl="openclaw logs --follow"
alias ocr="openclaw restart"
# Quick chat function
ask() { openclaw chat "$*"; }
# Usage: ask what is the capital of France?
Tip: Start with openclaw help and openclaw <command> --help to explore. The CLI is self-documenting, and tab completion makes discovering commands effortless.