- Posted on
- • Artificial Intelligence
Artificial Intelligence Bash Projects for Your Linux Portfolio
- Author
-
-
- User
- linuxbash
- Posts by this author
- Posts by this author
-
Artificial Intelligence Bash Projects for Your Linux Portfolio
Want a portfolio that stands out to Linux-savvy hiring managers? Show that you can glue AI into real-world command-line workflows. Bash is still the universal automation language on Linux, and pairing it with AI lets you ship powerful, practical tools that feel native to the terminal.
The problem/value: most devs can prompt an AI in a browser; far fewer can wire an LLM into scripts that accelerate git, log triage, or data wrangling on real systems. The following projects prove you can.
Why AI + Bash belongs in your portfolio
It’s realistic: SREs and DevOps engineers live in shells; AI that runs from Bash gets used.
It’s portable: Your scripts work across distros with minimal dependencies.
It’s composable: AI becomes just another Unix filter you can pipe into larger automations.
It’s impressive: Demonstrates API hygiene, security, and script robustness.
Note on models: these examples call an OpenAI-compatible HTTP API with curl. That could be a cloud provider or a local server that exposes an OpenAI-compatible endpoint. You’ll need:
Environment variables:
AI_API_BASE,AI_API_KEY, andAI_MODEL.jqfor JSON parsing.
Example environment setup (replace with your provider’s details):
export AI_API_BASE=https://api.openai.com/v1export AI_API_KEY=YOUR_KEY_HEREexport AI_MODEL=gpt-4o-mini
Install essentials if missing:
Debian/Ubuntu (apt):
sudo apt update && sudo apt install -y curl jq gitFedora/RHEL/CentOS (dnf):
sudo dnf install -y curl jq gitopenSUSE (zypper):
sudo zypper install -y curl jq git
Tip: If you prefer purely local models, you can swap the API for a local OpenAI-compatible server (many tools provide that). Your Bash stays the same.
Project 1: Terminal Chat Assistant (ai-chat.sh)
What you’ll build: a tiny CLI that chats with an LLM using curl, keeps prompts simple, and prints clean replies. Great for “explain this command,” “draft a one-liner,” or “summarize a file.”
Dependencies: curl, jq
Create ai-chat.sh:
#!/usr/bin/env bashset -euo pipefail: "${AI_API_BASE:?Set AI_API_BASE}" "${AI_API_KEY:?Set AI_API_KEY}" "${AI_MODEL:=gpt-4o-mini}"if [ $# -gt 0 ]; then INPUT="$*"; else INPUT="$(cat)"; fiPROMPT_JSON="$(jq -Rn --arg s "$INPUT" '$s')"PAYLOAD="$(jq -n --arg m "$AI_MODEL" --argjson u "$PROMPT_JSON" '{model:$m, messages:[{role:"system", content:"You are a concise Linux assistant. Prefer commands, be brief."},{role:"user", content:$u}], temperature:0.2}')"curl -sS -H "Authorization: Bearer ${AI_API_KEY}" -H "Content-Type: application/json" -d "$PAYLOAD" "${AI_API_BASE}/chat/completions" | jq -r '.choices[0].message.content'
Make it executable and test:
chmod +x ai-chat.sh./ai-chat.sh "List files modified in the last day with sizes in human units using GNU find."echo "Explain this awk one-liner: awk -F: 'NF>1{print $1}' /etc/passwd" | ./ai-chat.sh
Portfolio angle: shows you can do auth, JSON payloads, error handling, and neat terminal UX.
Project 2: AI-Powered Commit Message Generator (ai-commit.sh)
What you’ll build: a script that reads your staged diff and proposes a conventional, high-signal commit message.
Dependencies: git, curl, jq
Create ai-commit.sh:
#!/usr/bin/env bashset -euo pipefail: "${AI_API_BASE:?Set AI_API_BASE}" "${AI_API_KEY:?Set AI_API_KEY}" "${AI_MODEL:=gpt-4o-mini}"if ! git rev-parse --git-dir >/dev/null 2>&1; then echo "Not a git repo"; exit 1; fiDIFF="$(git diff --staged)"if [ -z "$DIFF" ]; then echo "No staged changes. Use: git add -p"; exit 1; firead -r -d '' INSTRUCTIONS <<'EOF'You are a senior engineer.Write a Conventional Commits style message for the staged diff.Rules:- Subject line <= 72 chars- Start with type(scope): subject (e.g., feat(ui): ..., fix(api): ...)- No trailing period in subject- Add a short body with WHAT and WHY (bullets).- Include BREAKING CHANGE: if applicable.EOFCONTENT="$(printf "%s\n\n--- DIFF START ---\n%s\n--- DIFF END ---\n" "$INSTRUCTIONS" "$DIFF")"PAYLOAD="$(jq -n --arg m "$AI_MODEL" --arg c "$CONTENT" '{model:$m, messages:[{role:"user", content:$c}], temperature:0.1}')"MSG="$(curl -sS -H "Authorization: Bearer ${AI_API_KEY}" -H "Content-Type: application/json" -d "$PAYLOAD" "${AI_API_BASE}/chat/completions" | jq -r '.choices[0].message.content')"printf "%s\n" "$MSG"
Usage:
chmod +x ai-commit.shgit add -p./ai-commit.sh | tee .git/AI_COMMIT_MSGgit commit -F .git/AI_COMMIT_MSG
Portfolio angle: shows domain prompts, content constraints, and safe handling of diffs.
Project 3: Log Triage Summarizer (ai-logsum.sh)
What you’ll build: a log pipeline that grabs the latest warnings/errors and asks the model for a short, actionable summary with likely root causes and next steps.
Dependencies: journalctl or /var/log/*, curl, jq
Create ai-logsum.sh:
#!/usr/bin/env bashset -euo pipefail: "${AI_API_BASE:?Set AI_API_BASE}" "${AI_API_KEY:?Set AI_API_KEY}" "${AI_MODEL:=gpt-4o-mini}"LINES="${1:-500}"if command -v journalctl >/dev/null 2>&1; thenLOGS="$(journalctl -p warning..alert -n "$LINES" --no-pager 2>/dev/null || true)"elseif [ -f /var/log/syslog ]; then SRC=/var/log/syslog;elif [ -f /var/log/messages ]; then SRC=/var/log/messages;else echo "No logs found"; exit 1; fiLOGS="$(tail -n "$LINES" "$SRC" 2>/dev/null | egrep -i 'warn|err|crit|fail|panic' || true)"fiSHORT="$(printf "%s\n" "$LOGS" | sed -E 's/^[A-Za-z]{3} [ 0-9]{2} [0-9:]{8} [^ ]+ //g' | head -n "$LINES")"read -r -d '' PROMPT <<'EOF'You are an SRE. Summarize these Linux logs in <= 10 bullets:- Group by component/service- Highlight top 3 incidents with likely root cause hypotheses- Suggest 3 concrete next-steps (commands to run or files to inspect)- Call out recurring patterns and rate severity low/med/highEOFCONTENT="$(printf "%s\n\n--- LOGS START ---\n%s\n--- LOGS END ---\n" "$PROMPT" "$SHORT")"PAYLOAD="$(jq -n --arg m "$AI_MODEL" --arg c "$CONTENT" '{model:$m, messages:[{role:"user", content:$c}], temperature:0.2}')"curl -sS -H "Authorization: Bearer ${AI_API_KEY}" -H "Content-Type: application/json" -d "$PAYLOAD" "${AI_API_BASE}/chat/completions" | jq -r '.choices[0].message.content'
Usage:
chmod +x ai-logsum.shsudo ./ai-logsum.sh 800
Portfolio angle: demonstrates log ingestion, normalization, and actionable output.
Project 4: OCR-to-Summary Pipeline (ai-ocrsum.sh)
What you’ll build: a script that OCRs a screenshot/photo using Tesseract and asks the model to summarize the content into clean, copy-ready notes.
Dependencies: tesseract-ocr, ImageMagick (for optional preprocessing), curl, jq
Install OCR tools:
Debian/Ubuntu (apt):
sudo apt update && sudo apt install -y tesseract-ocr imagemagickFedora/RHEL/CentOS (dnf):
sudo dnf install -y tesseract ImageMagickopenSUSE (zypper):
sudo zypper install -y tesseract ImageMagick
Create ai-ocrsum.sh:
#!/usr/bin/env bashset -euo pipefail: "${AI_API_BASE:?Set AI_API_BASE}" "${AI_API_KEY:?Set AI_API_KEY}" "${AI_MODEL:=gpt-4o-mini}"IMG="${1:-}"; [ -n "$IMG" ] || { echo "Usage: $0 image.(png|jpg|pdf)"; exit 1; }TMP="$(mktemp -d)"; trap 'rm -rf "$TMP"' EXITPRE="$TMP/pre.png"if file "$IMG" | grep -qi pdf; thenconvert -density 300 "$IMG"[0] -background white -alpha remove -strip "$PRE"elseconvert "$IMG" -colorspace Gray -resize 200% -contrast-stretch 0.5%x0.5% "$PRE"fiTEXT="$(tesseract "$PRE" stdout -l eng 2>/dev/null | sed 's/[[:cntrl:]]//g' | tr -s ' ' | head -c 8000)"read -r -d '' PROMPT <<'EOF'You are a meticulous technical note-taker. From this OCR text:- Fix obvious OCR errors if context is clear- Output clean bullet notes, code blocks as indented lines, and any TODOs- If content looks like a command output, add a one-line summary headerEOFCONTENT="$(printf "%s\n\n--- OCR TEXT START ---\n%s\n--- OCR TEXT END ---\n" "$PROMPT" "$TEXT")"PAYLOAD="$(jq -n --arg m "$AI_MODEL" --arg c "$CONTENT" '{model:$m, messages:[{role:"user", content:$c}], temperature:0.2}')"curl -sS -H "Authorization: Bearer ${AI_API_KEY}" -H "Content-Type: application/json" -d "$PAYLOAD" "${AI_API_BASE}/chat/completions" | jq -r '.choices[0].message.content'
Usage:
chmod +x ai-ocrsum.sh./ai-ocrsum.sh meeting-notes.png
Portfolio angle: shows classical ML (OCR) + LLM post-processing in a tidy UNIX pipeline.
Security and reliability tips
Never hardcode API keys. Use env vars:
export AI_API_KEY=...; consider.profileor a local.envexcluded from git.Add timeouts and retries to
curl:--max-time 30 --retry 2 --retry-all-errors.Guard inputs. Use
set -euo pipefailand validate file paths and git states.Document model, temperature, and token limits; make them overridable via env vars.
Package installation quick reference
jq
- apt:
sudo apt install -y jq - dnf:
sudo dnf install -y jq - zypper:
sudo zypper install -y jq
- apt:
git
- apt:
sudo apt install -y git - dnf:
sudo dnf install -y git - zypper:
sudo zypper install -y git
- apt:
curl
- apt:
sudo apt install -y curl - dnf:
sudo dnf install -y curl - zypper:
sudo zypper install -y curl
- apt:
tesseract + ImageMagick (for OCR project)
- apt:
sudo apt install -y tesseract-ocr imagemagick - dnf:
sudo dnf install -y tesseract ImageMagick - zypper:
sudo zypper install -y tesseract ImageMagick
- apt:
Optional local LLM note: If you run a local OpenAI-compatible server, set AI_API_BASE to its URL and choose an available AI_MODEL. If your local tool isn’t OpenAI-compatible, adapt the curl payload fields accordingly.
Wrap-up and next steps (CTA)
You now have 4 AI-powered Bash utilities that:
Chat in your terminal
Generate high-quality commit messages
Triage system logs
OCR and summarize screenshots
Polish them into a portfolio:
Create a public repo named
ai-bash-tools, one folder per project with a README, usage examples, and dependency section.Add a
Makefilewith targets likemake install(copies scripts to~/.local/bin).Include demo GIFs or asciinema casts.
Write brief design notes: tradeoffs, failure modes, and how to swap models/providers.
Tag issues for future enhancements (streaming output, persistent chat history, tests).
Then share your repo link on your resume and in relevant PRs. Hiring teams love to see hands-on automation that they can actually run.