Convert Figma logo to code with AI

htop-dev logohtop

htop - an interactive process viewer

6,293
424
6,293
272

Top Related Projects

20,379

A monitor of resources

26,585

Glances an Eye on your system. A top/htop alternative for GNU/Linux, BSD, Mac OS and Windows operating systems.

9,759

Yet another cross-platform graphical process/system monitor.

2,155

A TUI system monitor written in Rust

4,055

Terminal-based CPU stress and monitoring utility

9,705

System monitoring dashboard for terminal

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

  • Intuitive and interactive user interface with mouse support
  • Detailed process information and resource usage statistics
  • Customizable display with various view options and color schemes
  • Cross-platform compatibility (Linux, macOS, FreeBSD, and more)

Cons

  • May consume more system resources compared to the simpler top command
  • Some advanced features might be overwhelming for casual users
  • Limited remote monitoring capabilities without additional setup
  • Not pre-installed on most systems, requiring manual installation

Getting Started

To install htop on various systems:

# Ubuntu/Debian
sudo apt install htop

# CentOS/RHEL
sudo yum install htop

# macOS (using Homebrew)
brew install htop

# FreeBSD
pkg install htop

To run htop, simply open a terminal and type:

htop

Once running, you can use the following key commands:

  • F1: Help
  • F2: Setup (customize display)
  • F9: Kill process
  • F10 or Q: Quit

Navigate through processes using arrow keys, and press Enter to expand/collapse process trees.

Competitor Comparisons

20,379

A monitor of resources

Pros of btop

  • More visually appealing interface with graphs and color schemes
  • Supports mouse input for easier navigation and configuration
  • Offers a wider range of system information, including network and disk I/O

Cons of btop

  • Higher 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:

void Process_writeCommand(Process* this, int writefd) {
    int saved_errno = errno;
    if (write(writefd, this->comm, strlen(this->comm)) < 0) {
        // Handle error
    }
    errno = saved_errno;
}

btop:

void Proc::collect(const std::vector<std::string>& cpus, bool no_update) {
    if ((++coll_iter % 10 != 0 and not no_update) or collect_done) return;
    collect_done = true;
    // ... (additional code)
}

Both projects use C-based languages, with htop using C and btop using C++. The code snippets show different approaches to handling process-related operations, reflecting the overall design philosophies of each project.

26,585

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
  • Web-based interface for remote monitoring
  • Cross-platform support (Linux, macOS, Windows)

Cons of Glances

  • Higher resource usage due to more extensive monitoring
  • Steeper learning curve with more complex interface

Code Comparison

Glances (Python):

def get_stats():
    stats = {}
    stats['cpu'] = psutil.cpu_percent(interval=1)
    stats['memory'] = psutil.virtual_memory().percent
    return stats

htop (C):

static void ProcessList_scan(ProcessList* this) {
   LinuxProcessList* lpl = (LinuxProcessList*) this;
   ProcessList_goThroughEntries(this);
}

Summary

Glances offers more comprehensive monitoring and a web interface, making it suitable for remote system management. However, it consumes more resources and has a steeper learning curve. htop is lighter and focuses on process management with a simpler interface. The code comparison shows Glances using Python with the psutil library, while htop is written in C for lower-level system interactions.

9,759

Yet another cross-platform graphical process/system monitor.

Pros of bottom

  • Modern, customizable UI with mouse support and theming options
  • Built-in battery monitoring and temperature sensors
  • Cross-platform support (Linux, macOS, Windows)

Cons of bottom

  • Less mature project with fewer contributors
  • May consume more system resources than htop
  • Steeper learning curve for users familiar with htop

Code Comparison

htop:

void Process_writeCommand(Process* this, int attr) {
    int start = this->cmdlineBasenameOffset,
        end = this->cmdlineBasenameEnd;
    RichString_writeWide(this->cmdline, attr, &this->cmdlineWide[start],
                         end - start);
}

bottom:

pub fn draw_data(&mut self, f: &mut Frame<B>, area: Rect, force_redraw: bool) {
    if !self.is_visible() {
        return;
    }
    if force_redraw {
        self.is_dirty = true;
    }
}

Both projects aim to provide system monitoring capabilities, but bottom offers a more modern approach with additional features and cross-platform support. However, htop remains a more established and resource-efficient option with a simpler interface. The code comparison highlights the different programming languages used: C for htop and Rust for bottom, reflecting their respective design philosophies.

2,155

A TUI system monitor written in Rust

Pros of ytop

  • Written in Rust, offering potential performance benefits and memory safety
  • Modern, colorful, and aesthetically pleasing interface
  • Supports mouse input for easier navigation

Cons of ytop

  • Less mature and feature-rich compared to htop
  • Limited customization options
  • Smaller community and fewer contributors

Code Comparison

htop (C):

static void Process_writeCommand(Process* this, int attr) {
    int start = this->cmdlineBasenameOffset,
        end = this->cmdlineBasenameEnd;
    RichString_writeWide(this->cmdline, attr, &this->cmdline[start], end - start);
}

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 capabilities, but ytop offers a more modern approach with its Rust implementation and visually appealing interface. However, htop remains more feature-rich and customizable, with a larger community backing it. The code snippets showcase the different languages and approaches used in each project.

4,055

Terminal-based CPU stress and monitoring utility

Pros of s-tui

  • Graphical interface with real-time charts for CPU frequency, utilization, and temperature
  • Built-in stress test functionality for system benchmarking
  • Customizable color schemes and layout options

Cons of s-tui

  • Limited to CPU and temperature monitoring, lacking broader system resource views
  • Less mature project with fewer contributors and updates compared to htop
  • Python-based, which may have higher resource usage than C-based htop

Code Comparison

s-tui (Python):

def get_cpu_freq(self):
    cpu_freq = psutil.cpu_freq()
    return OrderedDict([
        ('Current', cpu_freq.current),
        ('Min', cpu_freq.min),
        ('Max', cpu_freq.max)
    ])

htop (C):

static void LinuxProcessList_scanCPUFrequency(LinuxProcessList* this) {
   unsigned long cpufreq = 0;
   for (int i = 0; i < this->super.cpuCount; i++) {
      cpufreq += Platform_getCPUFrequency(i);
   }
   this->cpuFrequency = cpufreq / this->super.cpuCount;
}

Both projects offer system monitoring capabilities, but s-tui focuses on graphical CPU and temperature monitoring with stress testing features, while htop provides a more comprehensive text-based system resource viewer. s-tui's Python implementation may be easier for some developers to contribute to, but htop's C-based code likely offers better performance for resource-constrained systems.

9,705

System monitoring dashboard for terminal

Pros of gtop

  • Built with JavaScript and Node.js, making it more accessible for web developers
  • Offers a modern, visually appealing interface with charts and graphs
  • Easier to install and run on systems with Node.js already installed

Cons of gtop

  • Less comprehensive system information compared to htop
  • May consume more system resources due to being built on Node.js
  • Limited customization options and keyboard shortcuts

Code Comparison

htop:

void Process_writeCommand(Process* this, int writefd) {
    int saved_errno = errno;
    if (write(writefd, this->comm, strlen(this->comm)) < 0) {
        // Handle error
    }
    errno = saved_errno;
}

gtop:

const drawDonut = (percent, innerRadius, outerRadius, label) => {
  const percentValue = percent.toFixed(1);
  const data = [{ percent: percentValue, label }];
  // ... (drawing logic)
};

Summary

htop is a more traditional, C-based system monitor with comprehensive features and lower resource usage. gtop offers a modern, JavaScript-based alternative with an attractive interface but fewer advanced features. The choice between them depends on user preferences, system requirements, and development background.

Convert Figma logo designs to code with AI

Visual Copilot

Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.

Try Visual Copilot

README

htop logo

CI Coverity Scan Build Status Mailing List IRC #htop GitHub Release Packaging status License: GPL v2+

Screenshot of htop

Introduction

htop is a cross-platform interactive process viewer.

htop allows scrolling the list of processes vertically and horizontally to see their full command lines and related information like memory and CPU consumption. Also system wide information, like load average or swap usage, is shown.

The information displayed is configurable through a graphical setup and can be sorted and filtered interactively.

Tasks related to processes (e.g. killing and renicing) can be done without entering their PIDs.

Running htop requires ncurses libraries, typically named libncurses(w).

htop is written in C.

For more information and details visit htop.dev.

Build instructions

Prerequisite

List of build-time dependencies:

  • standard GNU autotools-based C toolchain
    • C99 compliant compiler
    • autoconf
    • automake
    • autotools
  • ncurses

Note about ncurses:

htop requires ncurses 6.0. Be aware the appropriate package is sometimes still called libncurses5 (on Debian/Ubuntu). Also ncurses usually comes in two flavours:

  • With Unicode support.
  • Without Unicode support.

This is also something that is reflected in the package name on Debian/Ubuntu (via the additional 'w' - 'w'ide character support).

List of additional build-time dependencies (based on feature flags):

  • sensors
  • hwloc
  • libcap (v2.21 or later)
  • libnl-3 and libnl-genl-3

Install these and other required packages for C development from your package manager.

Debian/Ubuntu

sudo apt install libncursesw5-dev autotools-dev autoconf automake build-essential

Fedora/RHEL

sudo dnf install ncurses-devel automake autoconf gcc

Archlinux/Manjaro

sudo pacman -S ncurses automake autoconf gcc

macOS

brew install ncurses automake autoconf gcc

Compile from source:

To compile from source, download from the Git repository (git clone or downloads from GitHub releases), then run:

./autogen.sh && ./configure && make

Install

To install on the local system run make install. By default make install installs into /usr/local. To change this path use ./configure --prefix=/some/path.

Build Options

htop has several build-time options to enable/disable additional features.

Generic

  • --enable-unicode: enable Unicode support
    • dependency: libncursesw
    • default: yes
  • --enable-affinity: enable sched_setaffinity(2) and sched_getaffinity(2) for affinity support; conflicts with hwloc
    • default: check
  • --enable-hwloc: enable hwloc support for CPU affinity; disables affinity support
    • dependency: libhwloc
    • default: no
  • --enable-static: build a static htop binary; hwloc and delay accounting are not supported
    • default: no
  • --enable-debug: Enable asserts and internal sanity checks; implies a performance penalty
    • default: no

Performance Co-Pilot

  • --enable-pcp: enable Performance Co-Pilot support via a new pcp-htop utility
    • dependency: libpcp
    • default: no

Linux

  • --enable-sensors: enable libsensors(3) support for reading temperature data
    • dependencies: libsensors-dev(build-time), at runtime libsensors is loaded via dlopen(3) if available
    • default: check
  • --enable-capabilities: enable Linux capabilities support
    • dependency: libcap
    • default: check
  • --with-proc: location of a Linux-compatible proc filesystem
    • default: /proc
  • --enable-openvz: enable OpenVZ support
    • default: no
  • --enable-vserver: enable VServer support
    • default: no
  • --enable-ancient-vserver: enable ancient VServer support (implies --enable-vserver)
    • default: no
  • --enable-delayacct: enable Linux delay accounting support
    • dependencies: libnl-3-dev(build-time) and libnl-genl-3-dev(build-time), at runtime libnl-3 and libnl-genl-3 are loaded via dlopen(3) if available and requested
    • default: check

Runtime dependencies:

htop has a set of fixed minimum runtime dependencies, which is kept as minimal as possible:

  • ncurses libraries for terminal handling (wide character support).

Runtime optional dependencies:

htop has a set of fixed optional dependencies, depending on build/configure option used:

Linux

  • libdl, if not building a static binary, is always required when support for optional dependencies (i.e. libsensors, libsystemd) is present.
  • libcap, user-space interfaces to POSIX 1003.1e capabilities, is always required when --enable-capabilities was used to configure htop.
  • libsensors, readout of temperatures and CPU speeds, is optional even when --enable-sensors was used to configure htop.
  • libsystemd is optional when --enable-static was not used to configure htop. If building statically and libsystemd is not found by configure, support for the systemd meter is disabled entirely.
  • libnl-3 and libnl-genl-3, if htop was configured with --enable-delayacct and delay accounting process fields are active.

htop checks for the availability of the actual runtime libraries as htop runs.

BSD

On most BSD systems kvm is a requirement to read kernel information.

More information on required and optional dependencies can be found in configure.ac.

Usage

See the manual page (man htop) or the help menu (F1 or h inside htop) for a list of supported key commands.

Support

If you have trouble running htop please consult your operating system / Linux distribution documentation for getting support and filing bugs.

Bugs, development feedback

We have a development mailing list. Feel free to subscribe for release announcements or asking questions on the development of htop.

You can also join our IRC channel #htop on Libera.Chat and talk to the developers there.

If you have found an issue within the source of htop, please check whether this has already been reported in our GitHub issue tracker. If not, please file a new issue describing the problem you have found, the potential location in the source code you are referring to and a possible fix if available.

History

htop was invented, developed and maintained by Hisham Muhammad from 2004 to 2019. His legacy repository has been archived to preserve the history.

In 2020 a team took over the development amicably and continues to maintain htop collaboratively.

License

GNU General Public License, version 2 (GPL-2.0) or, at your option, any later version.