A terminal-based CPU monitoring tool written in Go. Features real-time CPU usage visualization with per-core monitoring, memory tracking, and system metrics.
- π Real-time CPU monitoring with sub-second refresh rates
- π Per-core usage tracking with multi-column layout for many-core systems
- π 60-second history graph with color-coded usage levels
- πΎ Memory usage monitoring with visual progress bars
- β‘ Low overhead - optimized to use only 1-2% CPU
- π― Interactive controls - pause, reset, and help system
- π₯οΈ Cross-platform - works on macOS and Linux
- Go 1.21 or higher
- Git
# Clone the repository
git clone https://github.com/yourusername/cpu-monitor.git
cd cpu-monitor
# Build and install
go build -o cpu-monitor ./cmd/cpu-monitor
# Optional: Move to PATH
sudo mv cpu-monitor /usr/local/bin/GOOS=darwin GOARCH=amd64 go build -o cpu-monitor-darwin-amd64 ./cmd/cpu-monitorGOOS=darwin GOARCH=arm64 go build -o cpu-monitor-darwin-arm64 ./cmd/cpu-monitorGOOS=linux GOARCH=amd64 go build -o cpu-monitor-linux-amd64 ./cmd/cpu-monitorGOOS=linux GOARCH=arm64 go build -o cpu-monitor-linux-arm64 ./cmd/cpu-monitor# Run with default settings
cpu-monitor
# Show help
cpu-monitor -help| Flag | Description | Default |
|---|---|---|
-refresh ms |
Set refresh rate in milliseconds (100-5000) | 500 |
-history n |
Number of history points to keep | 120 |
-avg n |
Moving average window size | 10 |
-help |
Show command line help | - |
# Update every second
cpu-monitor -refresh 1000
# Reduce history buffer for lower memory usage
cpu-monitor -history 60 -avg 5
# Fast refresh for detailed monitoring
cpu-monitor -refresh 100| Key | Action |
|---|---|
h |
Toggle help screen |
q, Ctrl+C |
Quit application |
r |
Reset CPU history |
p |
Pause/unpause monitoring |
- Total CPU: Overall system CPU usage percentage
- Moving Average: 10-sample moving average of CPU usage
- Core Bars: Individual CPU core usage with htop-style bars
- CPU History: 60-second vertical bar graph showing usage over time
- Memory: System RAM usage with visual progress bar
- System Info: Load average, process count, and uptime
- π’ Green (0-30%): Low usage
- π΅ Blue (30-50%): Light usage
- π‘ Yellow (50-70%): Moderate usage
- π Orange (70-90%): High usage
- π΄ Red (90-100%): Critical usage
CPU Monitor is highly optimized for minimal system impact:
- CPU Usage: ~1-2% on modern systems
- Memory: ~15-25 MB RAM
- Update Rate: Configurable from 100ms to 5 seconds
- Cached static system information
- Throttled expensive operations (temperature, process count)
- Pre-rendered UI styles
- Efficient string building
- Proper CPU sampling intervals
- OS: macOS 10.15+ or Linux kernel 3.0+
- Terminal: Any terminal with 256-color support
- Width: Minimum 80 columns
- Height: Minimum 24 rows
- Terminal: iTerm2, Alacritty, or Kitty
- Font: Monospace font with Unicode support
- Size: 120+ columns for optimal display
- Bubble Tea - Terminal UI framework
- Lip Gloss - Style definitions
- gopsutil - System information gathering
cpu-monitor/
βββ cmd/
β βββ cpu-monitor/ # Application entry point
βββ internal/
β βββ config/ # Configuration and constants
β βββ metrics/ # System metrics collection
β βββ ui/ # Terminal UI components
βββ go.mod # Go module definition
βββ go.sum # Dependency checksums
If CPU Monitor itself is using too much CPU:
- Increase the refresh rate:
cpu-monitor -refresh 1000 - Reduce history size:
cpu-monitor -history 60 - Check for other system monitoring tools running simultaneously
- macOS: Temperature sensors may require additional permissions or tools
- Linux: Ensure
lm-sensorsis installed:sudo apt-get install lm-sensors
- Ensure your terminal supports 256 colors:
echo $TERM - Try resizing your terminal window
- Use a monospace font with Unicode support
Contributions are welcome! Please feel free to submit a Pull Request.
- Fork the repository
- Create your feature branch (
git checkout -b feature/AmazingFeature) - Commit your changes (
git commit -m 'Add some AmazingFeature') - Push to the branch (
git push origin feature/AmazingFeature) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
- Built with Bubble Tea by Charm
- System metrics via gopsutil
- Inspired by htop, btop, and other terminal monitoring tools
Created with β€οΈ for the terminal by Ed Engelking as an experiment with Claude Code.