htop
htop is an interactive text-mode process viewer for Unix systems. It aims to be a better 'top'.
Top Related Projects
A monitor of resources
Glances an Eye on your system. A top/htop alternative for GNU/Linux, BSD, Mac OS and Windows operating systems.
System monitoring dashboard for terminal
A TUI system monitor written in Rust
Yet another cross-platform graphical process/system monitor.
Terminal-based CPU stress and monitoring utility
Quick Overview
htop is an interactive process viewer and system monitor for Unix-based systems. It provides a real-time, color-coded display of system resources, including CPU, memory, and process information. htop is an enhanced alternative to the traditional top command, offering a more user-friendly and feature-rich interface.
Pros
- Interactive and user-friendly interface with mouse support
- Detailed process information and resource usage statistics
- Customizable display with various color schemes and layout options
- Cross-platform compatibility (Linux, FreeBSD, OpenBSD, macOS)
Cons
- May consume more system resources compared to the simpler top command
- Learning curve for users accustomed to traditional top
- Limited functionality on some platforms (e.g., macOS) compared to Linux
Getting Started
To install htop on various systems:
# Ubuntu/Debian
sudo apt-get install htop
# CentOS/RHEL
sudo yum install htop
# macOS (using Homebrew)
brew install htop
# FreeBSD
pkg install htop
# Run htop
htop
Once installed, simply run htop
in the terminal to launch the application. Use arrow keys to navigate, F1-F10 for various functions, and 'q' to quit.
Competitor Comparisons
A monitor of resources
Pros of btop
- More visually appealing interface with customizable themes and layouts
- Supports disk I/O and network usage monitoring
- Offers battery status display for laptops
Cons of btop
- Higher system resource usage compared to htop
- Less mature project with potentially fewer contributors and community support
- May have a steeper learning curve for users familiar with htop's interface
Code Comparison
htop's main loop:
while (!quit) {
Settings_run(settings);
refreshTimeout = napTime;
int numCPUs = Platform_getProcessorCount();
bool drawAnyTagScreen = (activeTagScreen != NULL);
if (drawAnyTagScreen) {
[...]
}
}
btop's main loop:
while True:
if Config.update_ms > 0:
if (now := time.time() * 1000) - last_draw >= Config.update_ms:
draw(term, boxes, Fx.counter)
last_draw = now
else:
draw(term, boxes, Fx.counter)
[...]
Both projects use similar main loop structures, but btop is written in Python while htop uses C, potentially affecting performance and resource usage.
Glances an Eye on your system. A top/htop alternative for GNU/Linux, BSD, Mac OS and Windows operating systems.
Pros of Glances
- More comprehensive system monitoring, including network, disk I/O, and sensors
- Cross-platform support (Linux, macOS, Windows)
- Web-based interface option for remote monitoring
Cons of Glances
- Higher resource usage due to more extensive monitoring
- Steeper learning curve with more complex interface
- Less focused on process management compared to htop
Code Comparison
htop:
void Process_writeCommand(Process* this, int attr) {
int start = this->cmdlineBasenameOffset,
end = this->cmdlineBasenameEnd;
RichString_writeWide(this->cmdline, attr, this->comm);
}
Glances:
def get_process_tree(self):
tree = {}
for p in self.getlist():
ppid = p['ppid']
pid = p['pid']
tree[pid] = [p, ppid, []]
for pid in tree:
if tree[pid][1] in tree:
tree[tree[pid][1]][2].append(pid)
return tree
Both projects focus on system monitoring, but Glances offers a more comprehensive view with additional features. htop excels in process management and has a simpler, more focused interface. The code snippets show htop's C implementation for process command writing, while Glances uses Python to create a process tree structure.
System monitoring dashboard for terminal
Pros of gtop
- Modern, visually appealing interface with graphs and charts
- Built with JavaScript, making it easier for web developers to contribute
- Lightweight and easy to install via npm
Cons of gtop
- Less detailed system information compared to htop
- Not as widely adopted or battle-tested as htop
- May consume more resources due to its graphical nature
Code Comparison
htop (C):
static void Process_writeCommand(Process* this, int writeCommAs) {
int attr = CRT_colors[PROCESS_SHADOW];
int baseattr = CRT_colors[PROCESS_BASENAME];
RichString_begin(out);
// ... (additional code)
}
gtop (JavaScript):
function getProcesses() {
return new Promise((resolve, reject) => {
ps.lookup({}, (err, processes) => {
if (err) reject(err);
resolve(processes);
});
});
}
Both projects aim to provide system monitoring capabilities, but they differ in their approach and implementation. htop offers a more traditional, text-based interface with comprehensive system information, while gtop focuses on a modern, graphical representation of system metrics. The code snippets showcase the different languages used (C vs. JavaScript) and their respective approaches to handling processes.
A TUI system monitor written in Rust
Pros of ytop
- Written in Rust, offering better performance and memory safety
- Modern and visually appealing interface with colorful graphs
- Cross-platform support (Linux, macOS, Windows)
Cons of ytop
- Less mature and feature-rich compared to htop
- Smaller community and fewer contributors
- No longer actively maintained (archived repository)
Code Comparison
htop (C):
static void Process_writeCommand(Process* this, int attr, int baseattr, RichString* str) {
char* comm = this->comm;
int commLen = strlen(comm);
RichString_appendnAscii(str, attr, comm, commLen);
}
ytop (Rust):
pub fn draw<B: Backend>(&mut self, f: &mut Frame<B>, area: Rect) {
let chunks = Layout::default()
.direction(Direction::Vertical)
.constraints([Constraint::Length(3), Constraint::Min(0)].as_ref())
.split(area);
self.draw_header(f, chunks[0]);
self.draw_body(f, chunks[1]);
}
Both projects aim to provide system monitoring tools, but ytop offers a more modern approach with its Rust implementation and visually appealing interface. However, htop remains more feature-rich and actively maintained, making it a more reliable choice for advanced users and system administrators.
Yet another cross-platform graphical process/system monitor.
Pros of bottom
- Written in Rust, offering potential performance benefits and memory safety
- More customizable interface with themes and color schemes
- Supports exporting data and process searching
Cons of bottom
- Less mature project with potentially fewer features than htop
- May have a steeper learning curve for users familiar with htop
- Smaller community and ecosystem compared to htop
Code Comparison
htop (C):
static void Process_writeCommand(Process* this, int attr, int baseattr, RichString* str) {
char* comm = this->comm;
int commLen = strlen(comm);
RichString_appendnAscii(str, attr, comm, commLen);
}
bottom (Rust):
pub fn draw_process_list(&mut self, f: &mut Frame<B>, area: Rect, state: &mut State) {
let processes = state.processes.lock().unwrap();
let selected_pid = state.selected_pid.unwrap_or(0);
// ... (additional drawing logic)
}
Both projects aim to provide system monitoring capabilities, but bottom takes a more modern approach with Rust and offers additional customization options. However, htop remains a more established and widely-used tool with a larger user base and potentially more comprehensive features. The code snippets showcase the language differences, with bottom utilizing Rust's safety features and htop using C for low-level system interactions.
Terminal-based CPU stress and monitoring utility
Pros of s-tui
- Focuses specifically on stress testing and monitoring CPU performance
- Provides real-time graphs for temperature, frequency, power, and utilization
- Includes a built-in stress test feature for CPU benchmarking
Cons of s-tui
- Limited to CPU monitoring, lacking broader system resource tracking
- Less customizable interface compared to htop's extensive options
- Newer project with a smaller user base and community support
Code Comparison
s-tui (Python):
def get_cpu_freq(self):
"""Get the current CPU frequency."""
with open('/proc/cpuinfo', 'r') as f:
lines = f.readlines()
return float(lines[7].split(':')[1])
htop (C):
static void LinuxProcessList_scanCPUFrequency(LinuxProcessList* this) {
unsigned long cpufreq = 0;
FILE* f = fopen("/sys/devices/system/cpu/cpu0/cpufreq/scaling_cur_freq", "r");
if (f) {
if (fscanf(f, "%lu", &cpufreq) == 1)
this->cpuFrequency = cpufreq / 1000;
fclose(f);
}
}
Both projects aim to provide system monitoring capabilities, but s-tui focuses on CPU stress testing and graphical representation of CPU metrics, while htop offers a more comprehensive view of system processes and resources. s-tui is written in Python, making it more accessible for contributions, while htop is implemented in C for better performance.
Convert designs to code with AI
Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.
Try Visual CopilotREADME
htop
by Hisham Muhammad hisham@gobolinux.org
This repository is archived as htop is now maintained by a team of volunteers at htop.dev using an organisation-based git repository.
License
GNU General Public License, version 2 (GPL-2.0)
Top Related Projects
A monitor of resources
Glances an Eye on your system. A top/htop alternative for GNU/Linux, BSD, Mac OS and Windows operating systems.
System monitoring dashboard for terminal
A TUI system monitor written in Rust
Yet another cross-platform graphical process/system monitor.
Terminal-based CPU stress and monitoring utility
Convert designs to code with AI
Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.
Try Visual Copilot