Skip to content

htop-rust (Unix)

License

A minimal htop clone for Unix systems built with Rust and ratatui.

Features

  • Real-time Monitoring — CPU usage, memory consumption
  • Process Management — View, search, sort, and kill processes
  • Interactive TUI — Built with ratatui for responsive terminal UI
  • Process Details — View detailed process information
  • Flexible Refresh — Adjustable refresh interval

Installation

bash
cd htop/unix/rust
cargo build --release

# Binary location
./target/release/htop-unix-rust

Usage

Run directly:

bash
cargo run --release

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 100ms)

Process Actions

KeyAction
kKill selected process (SIGTERM → SIGKILL)
d/EnterShow/hide process details

General

KeyAction
qQuit
EscClose popup/cancel input

Process Kill Behavior

On Unix systems:

  1. First sends SIGTERM for graceful termination
  2. If process still alive after 2 seconds, sends SIGKILL

Note: Some system processes require root privileges to kill.

Display

  • CPU: Average usage across all cores
  • Memory: Used/Total (MiB) with percentage

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

Dependencies

  • ratatui — Terminal UI framework
  • crossterm — Cross-platform terminal manipulation
  • sysinfo — System information

Testing

bash
cargo test

Comparison with Windows Implementation

FeatureUnixWindows
Process killSIGTERM → SIGKILLtaskkill
Sparkline history
Shared library✅ htop_shared✅ htop_shared

License

MIT OR Apache-2.0