An interactive terminal-based system monitor for Linux, written in C using ncurses.
-
Real-time System Monitoring
- CPU usage with visual progress bar
- Memory usage with visual progress bar
- System load average (1, 5, and 15 minutes)
- Live process list with detailed information
-
Process Management
- Sortable process list (by PID, CPU, Memory, or Name)
- Display process state, CPU%, memory%, and nice values
- Scroll through process list with keyboard
-
User Interface
- Clean ncurses-based terminal UI
- Color-coded metrics (green/yellow/red based on usage)
- Keyboard navigation and controls
- Configurable refresh intervals
The project follows a modular design with clear separation of concerns:
- sysinfo.c/h: Data collection module - reads from /proc filesystem
- ui.c/h: UI rendering module - handles ncurses display and user interaction
- main.c: Main program - coordinates data collection and UI updates
- Linux operating system
- GCC compiler
- ncurses library
On Ubuntu/Debian:
sudo apt-get install libncurses5-dev libncursesw5-devOn Fedora/RHEL/CentOS:
sudo dnf install ncurses-develOn Arch Linux:
sudo pacman -S ncursesmakeThis will compile the source files and create the sysmon executable.
To clean build artifacts:
make cleanTo install system-wide:
sudo make installThis installs the binary to /usr/local/bin/sysmon.
To uninstall:
sudo make uninstallRun the system monitor:
./sysmonOr if installed system-wide:
sysmon-h, --help: Display help message-i, --interval SECONDS: Set refresh interval (default: 2 seconds)
Example with custom refresh interval:
./sysmon -i 5q: Quit the program↑/↓: Scroll through process listPgUp/PgDn: Page up/down in process listp: Sort by PID (ascending)c: Sort by CPU usage (descending)m: Sort by Memory usage (descending)n: Sort by process Name (ascending)r: Reverse current sort order
- CPU: Current CPU usage percentage with visual bar
- MEM: Memory usage percentage, visual bar, and used/total memory in MB
- Load: System load average for 1, 5, and 15 minutes
- Processes: Total number of running processes
- Sort: Current sort mode and direction
Each process shows:
- PID: Process ID
- NAME: Process name (truncated to 25 characters)
- STATE: Process state (R=Running, S=Sleeping, Z=Zombie, etc.)
- CPU%: CPU usage percentage
- MEM%: Memory usage percentage
- MEM(KB): Memory usage in kilobytes
- NICE: Process nice value (priority)
- Reads CPU statistics from
/proc/stat - Reads memory information from
/proc/meminfo - Reads load average from
/proc/loadavg - Reads process information from
/proc/[pid]/statand/proc/[pid]/status - Uses ncurses for terminal UI with color support
- Implements efficient process sorting algorithms
- Calculates CPU percentages based on time differences between samples
See LICENSE file for details.