--- name: bash-linux-v2 description: "Bash Linux Patterns workflow skill. Use this skill when the user needs Bash/Linux terminal patterns. Critical commands, piping, error handling, scripting. Use when working on macOS or Linux systems and the operator should preserve the upstream workflow, copied support files, and provenance before merging or handing off." version: "0.0.1" category: cli-automation tags: ["bash-linux-v2", "bash-linux", "bash", "linux", "terminal", "patterns", "critical", "commands"] complexity: intermediate risk: safe tools: ["codex-cli", "claude-code", "cursor", "gemini-cli", "opencode"] source: community author: "sickn33" date_added: "2026-04-19" date_updated: "2026-04-25" --- # Bash Linux Patterns ## Overview This public intake copy packages `plugins/antigravity-awesome-skills/skills/bash-linux` from `https://github.com/sickn33/antigravity-awesome-skills` into the native Omni Skills editorial shape without hiding its origin. Use it when the operator needs the upstream workflow, support files, and repository context to stay intact while the public validator and private enhancer continue their normal downstream flow. This intake keeps the copied upstream files intact and uses the `external_source` block in `metadata.json` plus `ORIGIN.md` as the provenance anchor for review. # Bash Linux Patterns > Essential patterns for Bash on Linux/macOS. --- Imported source sections that did not map cleanly to the public headings are still preserved below or in the support files. Notable imported sections: 1. Operator Syntax, 2. File Operations, 5. Environment Variables, 6. Network, 7. Script Template, 8. Common Patterns. ## When to Use This Skill Use this section as the trigger filter. It should make the activation boundary explicit before the operator loads files, runs commands, or opens a pull request. - This skill is applicable to execute the workflow or actions described in the overview. - Use when the request clearly matches the imported source intent: Bash/Linux terminal patterns. Critical commands, piping, error handling, scripting. Use when working on macOS or Linux systems. - Use when the operator should preserve upstream workflow detail instead of rewriting the process from scratch. - Use when provenance needs to stay visible in the answer, PR, or review packet. - Use when copied upstream references, examples, or scripts materially improve the answer. - Use when the workflow should remain reviewable in the public intake repo before the private enhancer takes over. ## Operating Table | Situation | Start here | Why it matters | | --- | --- | --- | | First-time use | `metadata.json` | Confirms repository, branch, commit, and imported path through the `external_source` block before touching the copied workflow | | Provenance review | `ORIGIN.md` | Gives reviewers a plain-language audit trail for the imported source | | Workflow execution | `SKILL.md` | Starts with the smallest copied file that materially changes execution | | Supporting context | `SKILL.md` | Adds the next most relevant copied source file without loading the entire package | | Handoff decision | `## Related Skills` | Helps the operator switch to a stronger native skill when the task drifts | ## Workflow This workflow is intentionally editorial and operational at the same time. It keeps the imported source useful to the operator while still satisfying the public intake standards that feed the downstream enhancer flow. 1. Task - Command 2. List processes - ps aux 3. Find by name - ps aux \ - grep node 4. Kill by PID - kill -9 5. Find port user - lsof -i :3000 6. Kill port - kill -9 $(lsof -t -i :3000) 7. Background - npm run dev & ### Imported Workflow Notes #### Imported: 3. Process Management | Task | Command | |------|---------| | List processes | `ps aux` | | Find by name | `ps aux \| grep node` | | Kill by PID | `kill -9 ` | | Find port user | `lsof -i :3000` | | Kill port | `kill -9 $(lsof -t -i :3000)` | | Background | `npm run dev &` | | Jobs | `jobs -l` | | Bring to front | `fg %1` | --- #### Imported: 4. Text Processing ### Core Tools | Tool | Purpose | Example | |------|---------|---------| | `grep` | Search | `grep -rn "TODO" src/` | | `sed` | Replace | `sed -i 's/old/new/g' file.txt` | | `awk` | Extract columns | `awk '{print $1}' file.txt` | | `cut` | Cut fields | `cut -d',' -f1 data.csv` | | `sort` | Sort lines | `sort -u file.txt` | | `uniq` | Unique lines | `sort file.txt \| uniq -c` | | `wc` | Count | `wc -l file.txt` | --- #### Imported: 1. Operator Syntax ### Chaining Commands | Operator | Meaning | Example | |----------|---------|---------| | `;` | Run sequentially | `cmd1; cmd2` | | `&&` | Run if previous succeeded | `npm install && npm run dev` | | `\|\|` | Run if previous failed | `npm test \|\| echo "Tests failed"` | | `\|` | Pipe output | `ls \| grep ".js"` | --- ## Examples ### Example 1: Ask for the upstream workflow directly ```text Use @bash-linux-v2 to handle . Start from the copied upstream workflow, load only the files that change the outcome, and keep provenance visible in the answer. ``` **Explanation:** This is the safest starting point when the operator needs the imported workflow, but not the entire repository. ### Example 2: Ask for a provenance-grounded review ```text Review @bash-linux-v2 against metadata.json and ORIGIN.md, then explain which copied upstream files you would load first and why. ``` **Explanation:** Use this before review or troubleshooting when you need a precise, auditable explanation of origin and file selection. ### Example 3: Narrow the copied support files before execution ```text Use @bash-linux-v2 for . Load only the copied references, examples, or scripts that change the outcome, and name the files explicitly before proceeding. ``` **Explanation:** This keeps the skill aligned with progressive disclosure instead of loading the whole copied package by default. ### Example 4: Build a reviewer packet ```text Review @bash-linux-v2 using the copied upstream files plus provenance, then summarize any gaps before merge. ``` **Explanation:** This is useful when the PR is waiting for human review and you want a repeatable audit packet. ## Best Practices Treat the generated public skill as a reviewable packaging layer around the upstream repository. The goal is to keep provenance explicit and load only the copied source material that materially improves execution. - Keep the imported skill grounded in the upstream repository; do not invent steps that the source material cannot support. - Prefer the smallest useful set of support files so the workflow stays auditable and fast to review. - Keep provenance, source commit, and imported file paths visible in notes and PR descriptions. - Point directly at the copied upstream files that justify the workflow instead of relying on generic review boilerplate. - Treat generated examples as scaffolding; adapt them to the concrete task before execution. - Route to a stronger native skill when architecture, debugging, design, or security concerns become dominant. ## Troubleshooting ### Problem: The operator skipped the imported context and answered too generically **Symptoms:** The result ignores the upstream workflow in `plugins/antigravity-awesome-skills/skills/bash-linux`, fails to mention provenance, or does not use any copied source files at all. **Solution:** Re-open `metadata.json`, `ORIGIN.md`, and the most relevant copied upstream files. Check the `external_source` block first, then restate the provenance before continuing. ### Problem: The imported workflow feels incomplete during review **Symptoms:** Reviewers can see the generated `SKILL.md`, but they cannot quickly tell which references, examples, or scripts matter for the current task. **Solution:** Point at the exact copied references, examples, scripts, or assets that justify the path you took. If the gap is still real, record it in the PR instead of hiding it. ### Problem: The task drifted into a different specialization **Symptoms:** The imported skill starts in the right place, but the work turns into debugging, architecture, design, security, or release orchestration that a native skill handles better. **Solution:** Use the related skills section to hand off deliberately. Keep the imported provenance visible so the next skill inherits the right context instead of starting blind. ## Related Skills - `@00-andruia-consultant` - Use when the work is better handled by that native specialization after this imported skill establishes context. - `@00-andruia-consultant-v2` - Use when the work is better handled by that native specialization after this imported skill establishes context. - `@10-andruia-skill-smith` - Use when the work is better handled by that native specialization after this imported skill establishes context. - `@10-andruia-skill-smith-v2` - Use when the work is better handled by that native specialization after this imported skill establishes context. ## Additional Resources Use this support matrix and the linked files below as the operator packet for this imported skill. They should reflect real copied source material, not generic scaffolding. | Resource family | What it gives the reviewer | Example path | | --- | --- | --- | | `references` | copied reference notes, guides, or background material from upstream | `references/n/a` | | `examples` | worked examples or reusable prompts copied from upstream | `examples/n/a` | | `scripts` | upstream helper scripts that change execution or validation | `scripts/n/a` | | `agents` | routing or delegation notes that are genuinely part of the imported package | `agents/n/a` | | `assets` | supporting assets or schemas copied from the source package | `assets/n/a` | ### Imported Reference Notes #### Imported: 2. File Operations ### Essential Commands | Task | Command | |------|---------| | List all | `ls -la` | | Find files | `find . -name "*.js" -type f` | | File content | `cat file.txt` | | First N lines | `head -n 20 file.txt` | | Last N lines | `tail -n 20 file.txt` | | Follow log | `tail -f log.txt` | | Search in files | `grep -r "pattern" --include="*.js"` | | File size | `du -sh *` | | Disk usage | `df -h` | --- #### Imported: 5. Environment Variables | Task | Command | |------|---------| | View all | `env` or `printenv` | | View one | `echo $PATH` | | Set temporary | `export VAR="value"` | | Set in script | `VAR="value" command` | | Add to PATH | `export PATH="$PATH:/new/path"` | --- #### Imported: 6. Network | Task | Command | |------|---------| | Download | `curl -O https://example.com/file` | | API request | `curl -X GET https://api.example.com` | | POST JSON | `curl -X POST -H "Content-Type: application/json" -d '{"key":"value"}' URL` | | Check port | `nc -zv localhost 3000` | | Network info | `ifconfig` or `ip addr` | --- #### Imported: 7. Script Template ```bash #!/bin/bash set -euo pipefail # Exit on error, undefined var, pipe fail # Colors (optional) RED='\033[0;31m' GREEN='\033[0;32m' NC='\033[0m' # Script directory SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" # Functions log_info() { echo -e "${GREEN}[INFO]${NC} $1"; } log_error() { echo -e "${RED}[ERROR]${NC} $1" >&2; } # Main main() { log_info "Starting..." # Your logic here log_info "Done!" } main "$@" ``` --- #### Imported: 8. Common Patterns ### Check if command exists ```bash if command -v node &> /dev/null; then echo "Node is installed" fi ``` ### Default variable value ```bash NAME=${1:-"default_value"} ``` ### Read file line by line ```bash while IFS= read -r line; do echo "$line" done < file.txt ``` ### Loop over files ```bash for file in *.js; do echo "Processing $file" done ``` --- #### Imported: 9. Differences from PowerShell | Task | PowerShell | Bash | |------|------------|------| | List files | `Get-ChildItem` | `ls -la` | | Find files | `Get-ChildItem -Recurse` | `find . -type f` | | Environment | `$env:VAR` | `$VAR` | | String concat | `"$a$b"` | `"$a$b"` (same) | | Null check | `if ($x)` | `if [ -n "$x" ]` | | Pipeline | Object-based | Text-based | --- #### Imported: 10. Error Handling ### Set options ```bash set -e # Exit on error set -u # Exit on undefined variable set -o pipefail # Exit on pipe failure set -x # Debug: print commands ``` ### Trap for cleanup ```bash cleanup() { echo "Cleaning up..." rm -f /tmp/tempfile } trap cleanup EXIT ``` --- > **Remember:** Bash is text-based. Use `&&` for success chains, `set -e` for safety, and quote your variables! #### Imported: Limitations - Use this skill only when the task clearly matches the scope described above. - Do not treat the output as a substitute for environment-specific validation, testing, or expert review. - Stop and ask for clarification if required inputs, permissions, safety boundaries, or success criteria are missing.