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, and AI_MODEL.

  • jq for JSON parsing.

Example environment setup (replace with your provider’s details):

  • export AI_API_BASE=https://api.openai.com/v1

  • export AI_API_KEY=YOUR_KEY_HERE

  • export AI_MODEL=gpt-4o-mini

Install essentials if missing:

  • Debian/Ubuntu (apt): sudo apt update && sudo apt install -y curl jq git

  • Fedora/RHEL/CentOS (dnf): sudo dnf install -y curl jq git

  • openSUSE (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 bash

  • set -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)"; fi

  • PROMPT_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 bash

  • set -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; fi

  • DIFF="$(git diff --staged)"

  • if [ -z "$DIFF" ]; then echo "No staged changes. Use: git add -p"; exit 1; fi

  • read -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.

  • EOF

  • CONTENT="$(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.sh

  • git add -p

  • ./ai-commit.sh | tee .git/AI_COMMIT_MSG

  • git 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 bash

  • set -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; then

  • LOGS="$(journalctl -p warning..alert -n "$LINES" --no-pager 2>/dev/null || true)"

  • else

  • if [ -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; fi

  • LOGS="$(tail -n "$LINES" "$SRC" 2>/dev/null | egrep -i 'warn|err|crit|fail|panic' || true)"

  • fi

  • SHORT="$(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/high

  • EOF

  • CONTENT="$(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.sh

  • sudo ./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 imagemagick

  • Fedora/RHEL/CentOS (dnf): sudo dnf install -y tesseract ImageMagick

  • openSUSE (zypper): sudo zypper install -y tesseract ImageMagick

Create ai-ocrsum.sh:

  • #!/usr/bin/env bash

  • set -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"' EXIT

  • PRE="$TMP/pre.png"

  • if file "$IMG" | grep -qi pdf; then

  • convert -density 300 "$IMG"[0] -background white -alpha remove -strip "$PRE"

  • else

  • convert "$IMG" -colorspace Gray -resize 200% -contrast-stretch 0.5%x0.5% "$PRE"

  • fi

  • TEXT="$(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 header

  • EOF

  • CONTENT="$(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 .profile or a local .env excluded from git.

  • Add timeouts and retries to curl: --max-time 30 --retry 2 --retry-all-errors.

  • Guard inputs. Use set -euo pipefail and 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
  • git

    • apt: sudo apt install -y git
    • dnf: sudo dnf install -y git
    • zypper: sudo zypper install -y git
  • curl

    • apt: sudo apt install -y curl
    • dnf: sudo dnf install -y curl
    • zypper: sudo zypper install -y curl
  • 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

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 Makefile with targets like make 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.