LinuxCommandLibrary

htop

Monitor system processes interactively

TLDR

Start htop

$ htop
copy

Start htop displaying processes owned by a specific user
$ htop [[-u|--user]] [username]
copy

Display processes hierarchically in a tree view to show the parent-child relationships
$ htop [[-t|--tree]]
copy

Sort processes by a specified sort_item (use htop --sort help for available options)
$ htop [[-s|--sort]] [sort_item]
copy

Start htop with the specified delay between updates, in tenths of a second (i.e. 50 = 5 seconds)
$ htop [[-d|--delay]] [50]
copy

Disable all system and process changing features
$ htop --readonly
copy

See interactive commands while running htop
$ [<F1>|<?>]
copy

Switch to a different tab
$ <Tab>
copy

SYNOPSIS

htop [OPTION]... [PID | COMMAND]

PARAMETERS

-C, --no-colour
    Suppress all colours

-c, --color-scheme=SCHEME
    Select colour scheme

-d SECS, --delay=SECS
    Delay between updates in tenths of a second

-h, --help
    Display help and exit

-F FILTER, --filter=FILTER
    Display processes matching filter

-l LINES, --lines=LINES
    Lines to show

-m, --no-mouse
    Disable mouse support

-n NUM, --iterations=NUM
    Number of iterations to run

-p PIDLIST, --pid=PIDLIST
    Comma-separated list of PIDs to show

-s KEY, --sort-key=KEY
    Sort by column KEY

-t, --tree
    Show tree view

-u USER, --user=USER
    Show only processes for USER

-U USER, --only-users=USER
    Show only processes for listed users

-v, --version
    Output version information and exit

-V, --running-in-cgroup
    Detect if running in cgroup

DESCRIPTION

htop is an advanced, interactive system-monitoring tool designed as an enhanced replacement for the traditional top command. It provides a colorful, full-screen interface for viewing and managing running processes in real-time.

Key features include vertical and horizontal scrolling to display all processes and full command lines, mouse support (since version 2.2), tree view of process hierarchies, customizable meters for CPU, memory, and swap usage, and the ability to filter, sort, and search processes interactively. Users can kill, renice, or adjust process affinities directly from the interface.

Unlike top, htop allows easy configuration via F2, supports multiple CPU cores visualization, and offers extensive keyboard shortcuts for efficient navigation. It's particularly useful for system administrators and developers troubleshooting performance issues, resource hogs, or high-load scenarios. htop requires the ncurses library and works on most Unix-like systems, though it's primarily targeted at Linux.

CAVEATS

htop requires a terminal with at least 80x24 size; mouse support needs a compatible terminal. Not installed by default on all distros (use package manager). May consume noticeable CPU on very busy systems.

KEY SHORTCUTS

F1/h: Help | F2: Setup | F3: Search | F5: Tree view | F6: Sort by field | F9: Kill | F10: Quit
Mouse: Scroll, right-click menus.

CONFIGURATION

Settings saved in ~/.config/htop/htoprc. Customize columns, meters, colours via F2 menu.

HISTORY

Developed by Hisham Muhammad, first released in 2004 as a top replacement. Became hugely popular for its usability. Maintained by multiple contributors since 2017; version 3.0 (2020) added Linux cgroup v2 support, tree view improvements, and more filters.

SEE ALSO

top(1), ps(1), free(1), kill(1), nice(1)

Copied to clipboard