Advanced Features
⌨️

Running Shell Commands Through OpenClaw

Execute terminal commands, scripts, and system operations through natural conversation.

5 min de leitura|
shell commandsterminalcommand execution

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 outdated or 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 sudo access
  • Shell commands run as your user with your permissions
  • Consider running OpenClaw in a sandboxed environment for added safety
shell commandsterminalcommand executionsystem operationsopenclaw shell

Pronto para seu assistente de IA?

Comece com o Claw for All hoje. Sem configuração, sem terminal, é só se cadastrar e usar.

Começar

Guias relacionados