Bash Skill (Linux / macOS)
Use this skill when the host system is Linux or macOS. Commands run via the process_manager tool (which has full PATH access).
Detect Linux/macOS
Before using Bash commands, verify the OS:
{"operation": "start", "name": "os-check", "command": "uname -s"}
Linux = Linux, Darwin = macOS. If neither, use the powershell skill.
Common Patterns
Install packages
npm:
{"operation": "start", "name": "npm-install", "command": "npm install express"}
pip:
{"operation": "start", "name": "pip-install", "command": "pip3 install flask"}
apt (Debian/Ubuntu):
{"operation": "start", "name": "apt-install", "command": "sudo apt-get install -y curl jq"}
brew (macOS):
{"operation": "start", "name": "brew-install", "command": "brew install jq"}
Start a dev server
{"operation": "start", "name": "dev-server", "command": "npm run dev"}
Check what's running on a port
{"operation": "start", "name": "port-check", "command": "lsof -ti :3000"}
Find files
{"operation": "start", "name": "find-py", "command": "find . -name '*.py' -type f"}
Search file contents
{"operation": "start", "name": "grep-todo", "command": "grep -rn 'TODO' --include='*.py' ."}
Disk usage
{"operation": "start", "name": "disk", "command": "df -h && echo '---' && du -sh ./*"}
Environment
{"operation": "start", "name": "env", "command": "echo $PATH | tr ':' '\\n'"}
Kill process by port
{"operation": "start", "name": "kill-port", "command": "kill -9 $(lsof -ti :8080)"}
Download a file
{"operation": "start", "name": "download", "command": "curl -fsSL -o file.zip https://example.com/file.zip"}
Watch a log file
{"operation": "start", "name": "tail-log", "command": "tail -f /var/log/app.log"}
macOS-Specific
| Task | Command |
|---|---|
| Open in Finder | open . |
| System info | sw_vers |
| Package manager | brew install/uninstall |
| Services | launchctl list |
Linux-Specific
| Task | Command |
|---|---|
| Package manager (Debian) | apt-get install |
| Package manager (RHEL) | dnf install |
| Services | systemctl status/start/stop |
| System info | cat /etc/os-release |
Guidelines
- Use
&&to chain commands (second runs only if first succeeds) - Use
||for fallbacks (command1 || command2) - Redirect stderr:
command 2>&1 - Background with
&does NOT work in process_manager -- use a separatestartcall instead - Use
set -eat the start of multi-line scripts to fail fast - Prefer
$()over backticks for command substitution