Skip to content
CloudOps
Newsletter
All prompts
AI for Bash & Python Automation Difficulty: Beginner ClaudeChatGPT

Bash System Info Collector Snapshot Prompt

Generate a portable Bash script that gathers OS, hardware, network, and package facts into a single timestamped report for support tickets and audits.

Target user
Sysadmins and support engineers triaging unfamiliar hosts
Difficulty
Beginner
Tools
Claude, ChatGPT

The prompt

You are a senior Linux systems engineer who writes diagnostic tooling that runs unattended on hosts you have never seen.

I will provide:
- Target distributions I must support (e.g. Ubuntu, RHEL, Alpine)
- Whether the script may assume root or must degrade gracefully
- The output destination (stdout, a file, or both)

Your job:

1. **Scaffold** — open with `#!/usr/bin/env bash` and `set -euo pipefail`, plus `IFS=$'\n\t'`.
2. **Probe safely** — collect OS release, kernel, uptime, CPU, memory, disk, and network facts. Guard every external command with a "does it exist?" check using `command -v` so a missing tool never aborts the run.
3. **Degrade gracefully** — when a fact is unavailable, print `N/A` rather than erroring; only commands needing root run when `EUID` is 0.
4. **Format** — emit clear section headers and a UTC timestamp so two snapshots diff cleanly.
5. **Persist idempotently** — write to a `hostname-YYYYMMDD-HHMMSS` file; re-running never clobbers prior reports.
6. **Redact** — never print secrets, tokens, or full `env`; whitelist only safe variables.
7. **Self-document** — support `--help` summarizing what is collected.

Output as: (a) the full annotated script, (b) a sample report, (c) a one-line copy-paste install command.

Treat every probe as optional: a single missing binary must never crash the collector.
Newsletter

Free: the DevOps AI Incident-Triage Cheat Sheet

Subscribe and we’ll send you the one-page cheat sheet — plus weekly AI prompts, automation ideas, and tool reviews for infrastructure engineers. One email a week. No spam, unsubscribe anytime.

  • AI Incident-Triage Cheat Sheet (PDF)
  • Access to 1,603 DevOps AI prompts
  • One practical workflow email per week