Running Shell Commands Through OpenClaw
Execute terminal commands, scripts, and system operations through natural conversation.
Shell Execution
The shell tool lets OpenClaw execute terminal commands on your behalf. It's like having a smart colleague at a computer who can run any command you describe.
Basic Usage
Ask naturally — OpenClaw translates to the right command:
- "How much disk space do I have?" →
df -h - "What's running on port 3000?" →
lsof -i :3000 - "Show me the largest files in Downloads" →
du -sh ~/Downloads/* | sort -rh | head - "Kill the process using port 8080" →
kill $(lsof -t -i:8080)
Safety and Confirmation
By default, OpenClaw asks for confirmation before executing commands. This is configurable:
{
"tools": {
"shell": {
"enabled": true,
"confirm": true,
"allowed_commands": ["ls", "cat", "grep", "find", "git"],
"blocked_commands": ["rm -rf", "sudo", "mkfs"]
}
}
}
Permission Levels
- Confirm all: Ask before every command
- Allow safe: Auto-run read-only commands, confirm destructive ones
- Allow all: Run everything without confirmation (use with caution)
Common Workflows
Development
- "Run the test suite" → Detects your test framework and runs it
- "Start the dev server" → Runs the appropriate start command
- "Check if any dependencies have updates" →
npm outdatedor equivalent
System Administration
- "Check system memory usage"
- "List all running Docker containers"
- "Show me the last 50 lines of the nginx error log"
- "Restart the PostgreSQL service"
File Operations
- "Find all TODO comments in the project"
- "Count lines of code by language"
- "Compress the logs directory into a zip file"
Git Operations
- "What's the status of my git repo?"
- "Show me the diff of my staged changes"
- "Create a new branch called feature/auth"
Output Handling
OpenClaw reads command output and can:
- Summarize lengthy output
- Extract relevant information
- Suggest follow-up actions
- Save output to files
Security Considerations
- Review the allowed/blocked command lists
- Be cautious with
sudoaccess - Shell commands run as your user with your permissions
- Consider running OpenClaw in a sandboxed environment for added safety
Ready for your AI assistant?
Get started with Claw for All today. No setup, no terminal, just sign up and go.
Get StartedRelated Guides
Using OpenClaw Canvas: Visual Workspace Guide
Create interactive diagrams, dashboards, and visual content with OpenClaw's Canvas feature.
Voice Commands and Talk Mode with OpenClaw
Use voice wake words and hands-free conversation with OpenClaw on macOS, iOS, and Android.
Web Search and Content Fetching with OpenClaw
Use web_search and web_fetch tools to find information and read web content.