SysLens is a lightweight, terminal-based system information utility written in C. It leverages Linux's virtual filesystems and system files to produce a real-time snapshot of system health, hardware specifications, and resource usage.
- System Overview: Displays OS name, kernel version, CPU model, GPU information, temperature, uptime, current user, shell, product name, USB devices, and power supply details.
- Resource Monitoring: Provides visual progress bars for RAM, swap, and disk usage, with color-coded alerts (green/yellow/red) for critical levels. Includes CPU usage percentage and load averages.
- Process Statistics: Summarizes total tasks along with counts of running, sleeping, and zombie processes. Displays top memory-consuming processes.
- Hardware Monitoring: Shows battery health and status for laptop systems.
- Performance Metrics: Real-time system load averages over 1, 5, and 15 minutes.
- Lightweight & Fast: Consumes minimal memory and runs without external dependencies.
The repository is organized as follows:
syslens/
├── include/
│ └── main.h # Header definitions and function prototypes
├── src/
│ ├── main.c # Program entry point and argument parsing
│ ├── mem.c # Memory, disk, and load average logic
│ ├── proc.c # Process parsing logic (/proc handling)
│ └── sys.c # OS and hardware info logic
├── LICENSE # MIT License
├── Makefile # Build automation script
└── README.md # This documentation
- Linux-based operating system
gcccompilermakeutility
- Clone or download the repository.
- Enter the project directory:
cd syslens - Compile the program:
make
To install syslens so it can be run from anywhere:
sudo make installRunning without arguments displays all available information. Flags can be used to show specific sections:
| Command | Description |
|---|---|
syslens |
Show all system, resource, and process info |
syslens -s |
Show only system info (OS, kernel, CPU, GPU, etc.) |
syslens -m |
Show resource usage (RAM, swap, disk, load average) |
syslens -p |
Show active process statistics |
syslens --version |
Display the current version |
syslens --help |
Display the help menu |
SysLens reads data from the Linux kernel's virtual /proc filesystem and other system files:
- CPU & Hardware: Parsed from
/proc/cpuinfo,/sys/class/dmi/id/product_name, and GPU info from system files. - Memory & Disk: Information from
/proc/meminfoandstatvfssystem call for disk usage calculations. - Processes: Iterates over PID directories under
/procand reads their/statusfiles. - Uptime & Load: Parsed from
/proc/uptimeand/proc/loadavg. - Power & Battery: Reads from
/sys/class/power_supply/for battery and power information. - USB Devices: Enumerates devices from
/sys/bus/usb/devices/. - Temperature: Reads thermal zone information from
/sys/class/thermal/.
To remove the installed binary from the system:
sudo make uninstallContributions are welcome! Please feel free to submit a Pull Request. For major changes, please open an issue first to discuss what you would like to change.
This project is licensed under the MIT License - see the LICENSE file for details.
- Version: 1.0.3
- Language: C
- Platform: Linux
- Dependencies: None (uses only standard C libraries and system files)
SysLens - Keep an eye on your system's vital signs!
