bash-helper
Understand natural language descriptions and generate bash commands for macOS/Linux with explanation.
When & Why to Use This Skill
The Bash Helper skill is a powerful natural language interface for the command line, designed to convert plain English descriptions into executable bash commands for macOS and Linux. It streamlines terminal workflows by handling complex syntax, managing platform-specific differences (BSD vs. GNU), and providing educational breakdowns of every command generated, making it an essential tool for both developers and system administrators.
Use Cases
- Complex File Discovery: Use natural language to find files based on specific attributes, such as 'find all log files larger than 50MB modified in the last 3 days'.
- Automated Text Processing: Perform advanced data extraction and manipulation using sed, awk, or ripgrep without memorizing complex regex or flags.
- System Monitoring and Management: Quickly generate commands to check disk usage, identify memory-intensive processes, or manage network ports.
- Cross-Platform Scripting: Automatically adjust command syntax for compatibility between macOS and Linux environments, such as handling the differences in 'sed -i' or 'date' commands.
- Safe Command Execution: Review detailed explanations of flags and potential risks before confirming the execution of destructive operations like recursive deletions or permission changes.
| name | bash-helper |
|---|---|
| description | Understand natural language descriptions and generate bash commands for macOS/Linux with explanation. |
Bash Helper Skill
Understand natural language descriptions and generate bash commands for macOS/Linux.
Usage
Invoke with: /bash-helper <description>
Example: /bash-helper find all python files larger than 1MB
Instructions
When this skill is invoked:
Parse the user's description
- Understand what the user wants to accomplish
- Identify the platform (macOS or Linux) from the environment
Generate the command
- Create the appropriate bash command
- Consider platform-specific differences (e.g.,
sed -ion Linux vssed -i ''on macOS) - Use modern alternatives when available (e.g.,
fdinstead offind,rginstead ofgrep)
Explain the command
- Break down each part of the command
- Explain flags and options used
- Note any potential side effects or risks
Ask for confirmation
- Display the command clearly
- Wait for user to confirm before execution
- Allow user to modify the command if needed
Execute and show results
- Run the command after confirmation
- Display the output
- Handle errors gracefully
Common Command Categories
File Operations
- Find files by name, size, date, type
- Copy, move, rename files
- Change permissions
- Create/delete directories
Text Processing
- Search text in files (grep/rg)
- Replace text (sed)
- Extract columns (awk/cut)
- Sort and filter
System Information
- Disk usage (df, du)
- Process management (ps, kill, top)
- Network info (netstat, lsof)
- System resources (free, uptime)
Archive Operations
- Create/extract tar, zip, gz
- Compress/decompress files
Network Operations
- Download files (curl, wget)
- Check connectivity (ping, traceroute)
- Port scanning (netcat)
Example Interaction
User: /bash-helper find all files modified in the last 24 hours
Assistant: I will find files modified in the last 24 hours.
**Command:**
```bash
find . -type f -mtime -1
Explanation:
find .- search in current directory-type f- only files (not directories)-mtime -1- modified within last 1 day (24 hours)
Alternative using fd (if installed):
fd --type f --changed-within 24h
Proceed with execution? [Y/n]
## Platform Differences
| Command | macOS | Linux |
|---------|-------|-------|
| `sed -i` | `sed -i ''` | `sed -i` |
| `date` | BSD date | GNU date |
| `xargs` | May need `-I{}` | `-i` or `-I{}` |
| `stat` | Different flags | Different flags |
## Safety Notes
- Commands with destructive potential (rm, mv, chmod -R) require explicit confirmation
- Always show what will be affected before executing
- For recursive operations, show a preview first
- Suggest using `-n` or `--dry-run` flags when available