Skip to content

htop-win-rust

License

A minimal htop clone for Windows built with Rust and ratatui, featuring sparkline history charts.

Features

  • Real-time Monitoring — CPU and memory usage with visual gauges
  • Sparkline History — Visual history charts for CPU/memory trends
  • Process Management — View, search, sort, and kill processes
  • Interactive TUI — Built with ratatui for responsive terminal UI
  • Process Details — View detailed process information

Installation

powershell
cd htop\win\rust
cargo build --release

# Binary location
.\target\release\htop-win-rust.exe

Prerequisites

Usage

powershell
# Run directly
cargo run --release

# Or run the built binary
.\target\release\htop-win-rust.exe

Note: If rebuilding, quit the running TUI first with q to avoid file lock errors.

Keyboard Shortcuts

KeyAction
/Select previous/next process
PgUp/PgDnPage up/down
Home/EndJump to first/last

Sorting

KeyAction
sCycle sort column (CPU → MEM → PID → Name)
rReverse sort order

Search/Filter

KeyAction
/Enter search mode
EnterApply filter
EscClear filter
BackspaceDelete character

Refresh Control

KeyAction
pPause/resume refresh
F5Force refresh
-Slow down (max 5000ms)
+/=Speed up (min 200ms)

Process Actions

KeyAction
kKill selected process
iShow/hide process details

General

KeyAction
qQuit
EscClose popup/cancel input

Display

Header Panel

  • CPU Gauge — Visual percentage bar with usage
  • Memory Gauge — Visual percentage bar with usage
  • Sparkline Charts — CPU and memory history

Process Table

ColumnDescription
PIDProcess ID
NAMEProcess name
CPU%CPU usage percentage
MEM(MiB)Memory usage in MiB

Process Details

  • Name and status
  • CPU% and memory
  • Executable path
  • Command line arguments

Process Kill on Windows

Uses Windows taskkill command:

  1. First attempts graceful termination
  2. Falls back to /F (force) if needed

Note: Administrator privileges may be required for some processes.

Dependencies

  • ratatui — Terminal UI framework
  • crossterm — Cross-platform terminal manipulation
  • sysinfo — System information
  • htop_shared — Shared library for common functions

Known Limitations

  • Some system processes cannot be terminated (permission denied)
  • Certain processes may not report full information
  • CPU% stabilizes after 1-2 refresh cycles

Testing

powershell
cargo test

Comparison with Go Implementation

FeatureRustGo
TUI Frameworkratatuitview
Sparkline history
Shared library
System infosysinfogopsutil

License

MIT OR Apache-2.0