A Bash toolkit for Linux system diagnostics, security auditing, and incident
response. It presents 290+ commands across 40 categories in a whiptail menu,
with a safety system that confirms before running anything that changes state.
- System recon: kernel, CPU, memory, disk, uptime, users, network
- Security: firewall rules, listening ports, failed logins, sudoers, SSH config, SUID/SGID
- Packages and services: installed packages, running/failed units, cron and timers
- Filesystem: mounts, block devices, large files, world-writable and hidden files
- Diagnostics: top processes, sockets, DNS lookups, traceroute, packet capture
- Reports: one-shot health check and full diagnostic export
- Three safety tiers (
SAFE/MODIFIES/DANGEROUS). Read-only commands run immediately; state-changing or destructive ones show a preview and require confirmation. - Automatic privilege handling. Commands that need root are detected and run with
sudo(prompting once), instead of failing silently. - Per-command timeout. Long-running or hung commands are killed rather than
freezing the menu (
SAK_TIMEOUT, default 120s). - Post-run actions: re-run, view in pager, save output to file, add to favorites.
- Missing-tool markers. Commands whose underlying tool isn't installed are flagged.
- Global keyword search, favorites, and command history.
- Strict mode (
set -uo pipefail) and automatic temp-file cleanup.
- Bash 4+
- Ubuntu/Debian (tested on 20.04+)
whiptail,coreutils,less. Other tools are prompted for per command.
chmod +x SWISS_ARMY_KNIFE.sh
sudo ./SWISS_ARMY_KNIFE.sh # interactive menu
# Non-interactive
./SWISS_ARMY_KNIFE.sh --health # run the health check
./SWISS_ARMY_KNIFE.sh --report # export a full diagnostic report
./SWISS_ARMY_KNIFE.sh --version
./SWISS_ARMY_KNIFE.sh --help
# Optional: per-command timeout in seconds
SAK_TIMEOUT=300 ./SWISS_ARMY_KNIFE.shRunning without sudo also works: the toolkit elevates only the commands that
need root and prompts once for your password.
| Tier | Behavior | Examples |
|---|---|---|
| SAFE | Runs immediately | df -h, ip a, lscpu |
| MODIFIES | Confirm before running | apt autoremove, systemctl restart, journalctl --vacuum-* |
| DANGEROUS | Warning + confirm | iptables -F, docker system prune -a |
- Results are shown in a scrollable dialog, or opened in
lesswhen large. - Any command's output can be saved to a timestamped file.
- Command history is logged to
~/.diagnostic_history; favorites to~/.diagnostic_favorites.
Pull requests welcome.
MIT.
SYSTEM HEALTH CHECK REPORT
Generated: ...
[SYSTEM]
Hostname: ubuntu-dev
Kernel: 5.15.0-91-generic
Uptime: up 3 days, 4 hours
[CPU]
Model name: Intel(R) Core(TM) i5
CPU(s): 2
[MEMORY]
total used free
Mem: 15Gi 6.2Gi 4.1Gi
[FAILED SERVICES]
none
[RECENT ERRORS - last 20]
...

