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.
Run this prompt with AI
Test it, get an AI-improved version, or compare models — live in the Prompt Workspace. No copy-paste.
Related prompts
-
Bash TCP Port Connectivity Diagnostic Prompt
Build a Bash script that checks TCP reachability to a set of host:port dependencies, times each connection, and produces a clear reachable/unreachable report for pre-flight or incident triage
-
Bash Nameref (declare -n) Indirect-Variable Script Prompt
Write a Bash script that uses namerefs (declare -n) to pass arrays and associative arrays into functions by reference and return structured results, replacing brittle eval-based indirection.
-
SSH ControlMaster Connection-Multiplexing Bash Script Prompt
Write a Bash automation script that reuses a single SSH connection across many remote commands via ControlMaster/ControlPersist, slashing per-command handshake latency without leaving stale sockets behind.
-
Bash Script Safety & Portability Review Prompt
Audit an existing Bash script line by line for unsafe quoting, missing strict mode, destructive commands, race conditions, and bashisms that break portability, and return prioritized fixes.
More Bash & Python Automation prompts & error guides
Browse every Bash & Python Automation prompt and troubleshooting guide in one place.
Reading prompts? Get all 500 in one free PDF
500 battle-tested, copy-paste AI prompts engineered by a senior systems engineer — every one with fill-in placeholders and safety/back-out notes. Drop your email and it's yours.
- 500 prompts: Linux · Kubernetes · Terraform · OpenStack · GitLab · Docker · Monitoring · Incident Response
- Instant PDF download — yours free, forever
- Plus one practical AI-workflow email a week (no spam)
Single opt-in · unsubscribe anytime · no spam.