exec — Command Execution
Description
Section titled “Description”Convert natural language descriptions into executable CLI commands with safety validation and confirmation prompts.
The exec
command bridges the gap between what you want to accomplish and the exact command syntax needed. Describe your goal in plain language, and Rawi will generate and optionally execute the appropriate command.
Synopsis
Section titled “Synopsis”rawi exec [description] [options]echo "description" | rawi exec [options]rawi exec [options] # Interactive mode
Arguments
Section titled “Arguments”description
(optional)
Natural language description of what you want to accomplish. If not provided, Rawi will:
- Read from stdin if available (piped input)
- Prompt interactively if running in a terminal
- Show help if no input is available
Options
Section titled “Options”Core Options
Section titled “Core Options”-p, --profile <profile>
Use a specific configuration profile for AI provider settings.
rawi exec "list running processes" --profile work
--dry-run
Show the generated command without executing it. Useful for learning and validation.
rawi exec "backup my home directory" --dry-run
--timeout <seconds>
Set maximum execution time for the generated command (default: 30 seconds).
rawi exec "compile large project" --timeout 300
--verbose
Show detailed information including provider type, model used, and execution steps.
rawi exec "system diagnostics" --verbose
--confirm
Always prompt for confirmation before executing commands, even for safe operations.
rawi exec "restart service" --confirm
--copy-command
Copy the generated command itself to clipboard before execution (enabled by default).
rawi exec "list all processes" --copy-command
Platform Behavior
Section titled “Platform Behavior”All platforms (Windows, macOS, Linux) support:
- Full Execution: Commands are generated and executed with appropriate safety checks
- Confirmation Prompts: Potentially dangerous commands require user confirmation
- Interactive Support: TTY-based commands work in interactive mode
- Safety Features: Command validation and timeout protection
Usage Examples
Section titled “Usage Examples”Basic Command Generation
Section titled “Basic Command Generation”# Simple file operationsrawi exec "list all files in current directory"rawi exec "show disk usage for home directory"rawi exec "find all Python files"
# System operationsrawi exec "show running processes"rawi exec "check memory usage"rawi exec "display network interfaces"
Piped Input
Section titled “Piped Input”# From other commandsecho "compress all log files" | rawi execprintf "backup database" | rawi exec --dry-run
# In scriptsTASK="monitor CPU usage for 30 seconds"echo "$TASK" | rawi exec --timeout 60
Usage Examples
Section titled “Usage Examples”Basic Command Execution
Section titled “Basic Command Execution”# Run ls command and explain outputrawi exec ls -la --prompt "Explain these files and permissions"
# Analyze system processesrawi exec ps aux --prompt "Which processes are using the most resources?"
# Examine network connectionsrawi exec netstat -tuln --prompt "Explain what services are running"
Specialized Analysis
Section titled “Specialized Analysis”# System diagnostics with expert templaterawi exec df -h --act system-expert --prompt "Identify disk space issues"
# Code analysisrawi exec find . -name "*.js" -type f -exec cat {} \; --act code-reviewer --prompt "Review this JavaScript code"
# Security assessmentrawi exec sudo nmap -sS localhost --act security-expert --prompt "Identify security vulnerabilities"
Interactive Mode
Section titled “Interactive Mode”# Start interactive promptrawi exec
# Will prompt: "What would you like to do?"# Enter: "find files modified in last 24 hours"
Development and System Administration
Section titled “Development and System Administration”# Development tasksrawi exec "start development server on port 3000"rawi exec "run tests in watch mode"rawi exec "build production bundle"
# System administrationrawi exec "check disk space on all mounted drives"rawi exec "show last 50 system log entries"rawi exec "list active network connections"
Safety and Validation
Section titled “Safety and Validation”# Preview dangerous operationsrawi exec "delete old log files" --dry-run
# Force confirmation for system changesrawi exec "restart network service" --confirm
# Use specific provider for consistent resultsrawi exec "complex git operation" --profile production
Use Cases
Section titled “Use Cases”🛠️ System Administration
Section titled “🛠️ System Administration”- Server Management: Generate commands for service control, monitoring, and maintenance
- File Operations: Create complex find, grep, and file manipulation commands
- Network Diagnostics: Generate networking and connectivity troubleshooting commands
👨💻 Development
Section titled “👨💻 Development”- Build & Deploy: Generate commands for compilation, testing, and deployment
- Git Operations: Create complex git commands for version control
- Environment Setup: Generate commands for development environment configuration
📊 Data Processing
Section titled “📊 Data Processing”- Log Analysis: Generate commands for log parsing and analysis
- File Processing: Create commands for data transformation and processing
- Monitoring: Generate commands for system and application monitoring
🎓 Learning
Section titled “🎓 Learning”- Command Discovery: Learn new CLI tools and their proper usage
- Best Practices: See recommended command patterns and options
- Documentation: Generate commands with proper flags and syntax
Safety Features
Section titled “Safety Features”Command Validation
Section titled “Command Validation”- Syntax Checking: Generated commands are validated for proper syntax
- Safety Analysis: Potentially dangerous operations are flagged
- Context Awareness: Commands are generated with awareness of current system state
User Control
Section titled “User Control”- Dry Run Mode: Preview commands before execution
- Confirmation Prompts: User approval required for execution
- Timeout Protection: Automatic termination of long-running commands
Session Logging
Section titled “Session Logging”- Command History: All generated commands are logged for review
- Execution Results: Command output and exit codes are recorded
- Session Management: Commands are organized by session for easy tracking
Integration with Other Commands
Section titled “Integration with Other Commands”With History
Section titled “With History”# View exec command historyrawi history exec
# Search for specific commandsrawi history exec --search "docker"
# View exec sessions from specific profilerawi history exec --profile production
With Profiles
Section titled “With Profiles”# Use different providers for different tasksrawi exec "server deployment" --profile productionrawi exec "development setup" --profile personal
With Templates
Section titled “With Templates”While exec doesn’t directly use act templates, you can combine them:
# Use ask with template, then exec the resultrawi ask --act devops "What command should I use to monitor disk I/O?"# Then use the suggestion with execrawi exec "monitor disk I/O in real-time"
Best Practices
Section titled “Best Practices”Writing Effective Descriptions
Section titled “Writing Effective Descriptions”✅ Good Examples:
- “list all files modified in the last 24 hours”
- “show running Docker containers with their resource usage”
- “backup the database to timestamped file”
❌ Avoid:
- “do something with files” (too vague)
- “ls -la” (already a command, describe the goal instead)
- “help” (use —help instead)
Safety Guidelines
Section titled “Safety Guidelines”- Use
--dry-run
first for unfamiliar operations - Be specific about what you want to accomplish
- Review generated commands before execution
- Use
--confirm
for system-critical operations - Check command history to track what was executed
Profile Management
Section titled “Profile Management”- Use different profiles for different environments (dev, staging, prod)
- Configure appropriate models for different complexity levels
- Set up dedicated profiles for specific use cases (security, development, etc.)
Troubleshooting
Section titled “Troubleshooting”Common Issues
Section titled “Common Issues”“Command not found” errors
- The generated command uses tools not installed on your system
- Install required tools or specify alternatives in your description
Timeout errors
- Increase timeout with
--timeout <seconds>
- Use
--dry-run
to check if the command is appropriate
Permission denied
- Generated command requires elevated privileges
- Consider if
sudo
is needed or use a different approach
Getting Better Results
Section titled “Getting Better Results”- Be specific about your environment and requirements
- Mention constraints like operating system or available tools
- Use appropriate profiles configured for your use case
- Provide context about what you’re trying to achieve
Related Commands
Section titled “Related Commands”ask
- For general AI questions and explanationschat
- For interactive problem-solving sessionshistory
- To review and manage exec command historyconfigure
- To set up AI providers and profiles
Examples by Category
Section titled “Examples by Category”File Operations
Section titled “File Operations”rawi exec "find all JavaScript files larger than 1MB"rawi exec "compress all log files older than 30 days"rawi exec "copy all photos to backup directory"
System Monitoring
Section titled “System Monitoring”rawi exec "show top 10 processes by CPU usage"rawi exec "monitor memory usage every 5 seconds"rawi exec "check network connectivity to specific host"
Development
Section titled “Development”rawi exec "run TypeScript compiler in watch mode"rawi exec "start Docker container with port mapping"rawi exec "create new Git branch for feature development"
Data Processing
Section titled “Data Processing”rawi exec "extract specific columns from CSV file"rawi exec "count lines in all Python files"rawi exec "search for pattern in log files from last week"