Zum Hauptinhalt springen
tsecurity.de LIVE
Echtzeit-Radar & Feeds
Alle RSS Feeds
👥 Community & Social
Sichere ProgrammierungLandlock LSM: Sandbox-Linux ohne Root-Rechte sichern(22.09.2026 um 02:00 Uhr)
Sichere ProgrammierungQuarkus + GraalVM Advanced Obfuscation(22.09.2026 um 02:00 Uhr)
Sichere Programmierung06 — Chat Works. Does the Agent Actually Retrieve Memory?(22.09.2026 um 02:03 Uhr)
Sichere ProgrammierungMCP Debate: Token Tax, Context Bloat, and What Devs Can Do(22.09.2026 um 02:03 Uhr)
Sichere ProgrammierungI gave my AI agent a kill switch tied to its own bank balance(22.09.2026 um 02:08 Uhr)
Sichere ProgrammierungLandlock LSM: Sandbox-Linux ohne Root-Rechte sichern(22.09.2026 um 02:00 Uhr)
Sichere ProgrammierungQuarkus + GraalVM Advanced Obfuscation(22.09.2026 um 02:00 Uhr)
Sichere Programmierung06 — Chat Works. Does the Agent Actually Retrieve Memory?(22.09.2026 um 02:03 Uhr)
Sichere ProgrammierungMCP Debate: Token Tax, Context Bloat, and What Devs Can Do(22.09.2026 um 02:03 Uhr)
Sichere ProgrammierungI gave my AI agent a kill switch tied to its own bank balance(22.09.2026 um 02:08 Uhr)
Intelligence View
⚡ tsecurity.de Intelligence

🧠 I built a full system monitor in Bash — and fought awk along the way 💀

I wanted to see how far I could push pure Bash before it collapses under its own syntax. So, naturally, I decided to write a system monitoring tool — in Bash. And thus, system-monitor was born: 👉 GitHub repo Yes, it’s fully functional. Y…

0
↗ Quelle (dev.to)
Reagiere als Erste:r — dein Feedback zählt!

I wanted to see how far I could push pure Bash before it collapses under its own syntax.

So, naturally, I decided to write a system monitoring tool — in Bash.

And thus, system-monitor was born:

👉 GitHub repo



Yes, it’s fully functional. Yes, it uses colors. Yes, awk is involved.


No, I don’t recommend doing this sober. 😅







💡 The idea



I wanted a single script that could show:




  • CPU load and number of cores

  • RAM usage and percentage

  • Disk space for /

  • Network I/O

  • Process count
    Basically, the “lazy Linux admin toolkit” in one file.
    Something like this:



./system-monitor.sh





and boom — everything you’d usually get from top, free, df, and ip combined.





⚙️ The features



What started as a 10-line script turned into a 250+ line CLI tool with:




  • Command-line arguments (--help, --brief, --no-color, --version, -i N)

  • Colorized output for warnings/critical thresholds

  • Continuous monitoring mode

  • Safe shutdown with signal trapping (Ctrl+C)

  • Brief (machine-readable) mode for piping into other scripts

  • Dependency checks and graceful error handling



Example:




./system-monitor.sh -i 5 --no-color







Updates every 5 seconds without colors.

Press Ctrl+C to stop — yes, it even says goodbye politely.







🧩 Some code highlights



Color management:




RED='\033[0;31m'
YELLOW='\033[1;33m'
GREEN='\033[0;32m'
NC='\033[0m'






Because monitoring your system is serious business — but who doesn’t love a bit of RGB?



Load detection magic:




CPU_LOAD_1MIN=$(cat /proc/loadavg | awk '{print $1}')
CPU_CORES=$(nproc)
load_percent=$(echo "scale=0; ($CPU_LOAD_1MIN * 100) / $CPU_CORES" | bc)






That moment when you realize you’re using awk, bc, and /proc in one line and it actually works.



Network metrics:




interface=$(ip route get 8.8.8.8 | awk '{print $5}' | head -1)
rx=$(cat /sys/class/net/$interface/statistics/rx_bytes)
tx=$(cat /sys/class/net/$interface/statistics/tx_bytes)






I like to imagine Bash crying softly every time it runs this.






🧠 What I learned




  • Bash can do a lot — if you’re patient (and slightly masochistic).

  • Quoting is a survival skill. Forget one and you’re debugging for hours.


  • awk is an ancient curse. It always works, but never for the reason you expect.

  • Color helps debugging. Visual feedback saves your sanity.

  • Document your code. Because 3 a.m. you will have no clue what that $7 in awk '{print $7}' was.






🧰 The brief mode



I added a --brief flag that outputs all metrics in a machine-readable format — perfect for logging or Prometheus-style integration.




./system-monitor.sh --brief






Output:




timestamp=1730765432
cpu_load_percent=12
mem_usage_percent=43.5
disk_usage_percent=56
network_rx_mb=12.4
process_count=187






Basically, JSON for people who hate themselves.






🧯 Safety first: signal handling



If you hit Ctrl+C, it doesn’t just die — it politely says goodbye:




trap cleanup INT TERM

cleanup() {
echo -e "\nMonitoring stopped. Goodbye!"
exit 0
}






Because professionalism.






🚀 AUR packaging



After testing it on Arch, I thought — why not go all in?

So I wrote a PKGBUILD, threw it into the AUR, and now you can literally install it with:




yay -S system-monitor






And that’s the moment I realized:




“Oh no. I’ve become that guy who writes Bash utilities for other people.”







🧭 Final thoughts



Was this efficient? Probably not.

Did I learn a lot? Absolutely.



Here’s what I got from it:




  • Deep understanding of Bash syntax and traps

  • Practical use of /proc and awk

  • Appreciation for proper CLI design

  • And a newfound respect for people who don’t do this in Bash



If you’re thinking of writing your first utility — do it.

Even if it’s messy. Even if awk haunts your dreams.



Because once you see your tool working, it’s worth every headache.






🔗 Links



🐧 GitHub: https://github.com/DanLinX2004X/system-monitor



📦 AUR: https://aur.archlinux.org/packages/system-monitor

Ähnliche Beiträge
🔍 Verwandte News

Auch interessante Nachrichten 🧠 I built a full system monitor in Bash — and fought awk along the way 💀

Thematisch verwandte Begriffe: built, full, system, monitor · 6 Treffer

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Zum Aktualisieren ziehen
ZERO-DAY CVE-2026-49449 | Joplin is an open source note-taking and to-do application that organise…
Advisory →
TTS Reader • tsecurity.de Voice
tsecurity.de Icon
tsecurity.de App
Offline-Lesen, Eilmeldungen & 0ms Ladezeit

Installiere tsecurity.de direkt auf deinen Home-Bildschirm für das ultimative Vollbild-Magazinerlebnis ohne Browser-Leisten.

Nächster Beitrag
Themen-Radar & Intelligence Matrix
Echtzeit-Taxonomie nach Angriffsvektoren & Plattformen

tsecurity.de Live Threat Radar

🔴 LIVE RADAR
MONITORING
AKTIV
CVE-DATENBANK
LIVE
🔍
Community Radar & Live Chat
Sentinel Bot online • Live-Stream
Dein Cluster: Security Explorer
Match:
lädt…
Verbindung zum Community-Stream wird aufgebaut...
Bearbeitungsmodus — Senden überschreibt deine Nachricht
Community-Puls — was gerade passiert
lädt…
Aktivitäten deiner Analysten
lädt…
Neues Thema oder Eilmeldung einreichen

Reiche interessante Links, Zero-Days oder Debatten ein. Die Community entscheidet per Upvote über die Veröffentlichung.

Heiß diskutierte Einreichungen
🔖 Gespeicherte Artikel
📂 Keine gespeicherten Artikel vorhanden.
Zurück Ziehen Vor
Links: vorheriger Artikel Rechts: nächster Artikel unten: schließen
News NIS-2 Frühwarnung Tier-1 Intel ⏱️ 3 Min vor 10 Min
Artikeldaten werden geladen...

Zurück: vorheriger Vor: nächster
↗ Original-Quelle
Social Reaktionen Deine Reaktion zählt
Einstufung & Relevanz-Poll 0 Stimmen
In sozialen Netzwerken teilen 1-Klick