A lightweight terminal UI for real-time Linux system stats, built with FTXUI. Reads directly from /proc — no external dependencies for data collection.
- Hostname — read from
/etc/hostname - CPU usage — computed from
/proc/statdeltas, plus clock speed from/proc/cpuinfo - Memory usage — total and used, from
/proc/meminfo - Network throughput — combined upload/download rate across
eth*,wl*, anden*interfaces, from/proc/net/dev - Uptime — from
/proc/uptime - Live-updating gauges with a green → yellow → red gradient based on load
- Runs on a background polling thread; the UI thread only re-renders on change
- Linux (relies on
/procand/etc/hostname) - FTXUI
- CMake (recommended for pulling in FTXUI)
Using CMake with FTXUI fetched as a dependency:
mkdir build
cmake -S . -B ./build -DCMAKE_BUILD_TYPE=Release
cmake --build ./buildIf you choose to build and link FTXUI yourself, ftxui-component must be first in the linking order relative to the other FTXUI libraries, i.e.
g++ ./src/main.cpp -O2 -DNDEBUG -lftxui-component -lftxui-dom -lftxui-screen -lpthread -o ./build/main./build/main [refresh_ms]refresh_ms— polling interval in milliseconds (default:1000)- Press
qto quit
Example, refreshing every 500 ms:
./main 500nfolens runs two threads:
- Worker thread — polls
/proc/uptime,/proc/cpuinfo,/proc/meminfo,/proc/net/dev, and/proc/staton each interval, computes deltas (CPU busy time, network bytes/sec), and writes the results into a mutex-guarded shared struct. - UI thread — an FTXUI render loop that redraws whenever the worker thread posts a "changed" event, reading a locked snapshot of the shared state.
CPU usage is derived from the change in total vs. idle jiffies between two /proc/stat reads, rather than a single instantaneous read. Network rate is derived similarly from cumulative byte counters in /proc/net/dev.
- Currently Linux-only (depends on procfs).
- Network interfaces are matched by name prefix (
eth,wl,en); interfaces named differently (e.g. custom VPN/tunnel names) won't be counted. - Assumes a single CPU frequency line format from
/proc/cpuinfo; behavior only tested on x86_64 architecture.
