Introduction
This cheatsheet gives practical prompts for system administration, DevOps, and SRE work. Each entry shows the pattern, an example prompt, and the expected outcome. Use this as a quick reference alongside the full guide: Prompt Engineering for System Administration
.
Script generation
| Pattern | Example prompt | Outcome |
|---|
| Disk monitoring | Write a Bash script for Ubuntu 22.04 that checks disk usage on / every hour and emails an alert if usage exceeds 80 percent. | Generates a shell script with df and mail integration, suitable for cron. |
| Process monitoring | Create a PowerShell script that lists all processes consuming more than 200MB RAM, sorted by usage. | Outputs a PowerShell script using Get-Process with filtering and sorting. |
| Log rotation | Write a Bash script to rotate logs in /var/log/myapp/ weekly, keeping 4 backups. | Produces a logrotate-style script with compression and retention. |
Config generation
| Pattern | Example prompt | Outcome |
|---|
| Web server | Generate an Nginx reverse proxy config for a Flask app on port 5000, including SSL with Let’s Encrypt. | Secure Nginx config with proxy settings and SSL block. |
| Database | Write a PostgreSQL pg_hba.conf that allows local connections for role appuser but denies remote access. | Access control config with explicit host rules. |
| Kubernetes | Provide a Kubernetes YAML to deploy a Redis pod with a PersistentVolumeClaim for storage. | Complete manifest with pod, PVC, and deployment spec. |
Log analysis
| Pattern | Example prompt | Outcome |
|---|
| Web logs | Analyze this Apache access log and summarize the 3 most common HTTP status codes. | Produces a frequency breakdown of codes like 200, 404, 500. |
| Database logs | Here are 50 lines from a MySQL error log. Identify recurring errors and likely causes. | Highlights repeated issues such as failed connections or table corruption. |
| System logs | Review this syslog snippet and explain which service is failing and why. | Identifies service failures and suggests possible fixes. |
Security audits
| Pattern | Example prompt | Outcome |
|---|
| SSH | Audit this sshd_config and list insecure settings. Suggest safer alternatives. | Flags weak ciphers, root login enabled, missing restrictions. |
| Nginx | Review this nginx.conf for security hardening. Recommend headers like CSP and HSTS. | Produces a list of security header improvements. |
| Containers | Given this Dockerfile, point out potential security issues and propose fixes. | Identifies risky practices like running as root or using latest tags. |
Documentation and runbooks
| Pattern | Example prompt | Outcome |
|---|
| Service restart | Write a runbook for restarting PostgreSQL on Ubuntu 22.04 safely. | Step-by-step checklist with commands and verification steps. |
| Incident response | Draft incident response steps for diagnosing an Nginx 502 Bad Gateway error. | Procedural guide: check upstream service, logs, and configs. |
| Deployment | Document the steps to roll out a new version of a Dockerized app using Kubernetes rolling updates. | Ordered instructions with kubectl commands and rollback strategy. |
Best practices
- Always provide OS, tool, or service versions for accurate answers
- Ask for explanations, not just code or configs
- Request non-destructive commands first (dry runs, safe flags)
- Treat generated output as a draft and validate before use
Further reading