htop

From LinuxReviews
Jump to navigationJump to search
Terminal.png

htop is a small useful ncurses-based cli system monitoring program which lists the systems processes. It has colors (unlike regular top) and the ability to scroll both vertically and horizontally to see programs full comamnd lines. htop can sort processes by CPU, memory, user, priority and quite a few other metrics. There is also a tree view which groups processes by parent. It can re-nice and kill processes with the Fn keys. htop can be very useful simple monitoring of both servers and workstations.

Features and Usability[edit]

Htop-2.2.0.jpg
htop version 2.2.0 running on a CentOS 7 box.

  • The arrow keys can be used used to scroll up and down as well as horizontally.
  • PgUp and PgDn can be used to jump up and down in the process list.
  • The Fx keys can be used to take advantage of htop's many features (similar to Midnight Commander). There's:
    • Search (F3),
    • Filter(ing) (F4),
    • Tree view (F5),
    • Process sorting (F6),
    • Changing a process's "nice" priority value (F7 and F8)
    • Terminating (killing) processes (F9).
    • F10 quits htop.

Htop-2.2.0-sort.jpg
Pressing F6 in htop brings up a list of available criteria for sorting the process list. There's PID, PRIORITY, NICE, M_SIZE, M_RESIDENT, M_SHARE, STATE, PERCENT_CPU, PERCENT_MEM, TIME and Command.

Changing a processes CPU priority (nice value) is done with (F7 and F8). htop can also be used to change a processes I/O priority - otherwise done with ionice (manual}) - by pressing i on a line in the process list.

Htop-2.2.0-processview.jpg
Pressing l on a process will invoke lsof and present a list of it's open file descriptors.

Pressing l on a process's line will invoke lsof (if installed) and list the processes open file descriptors. This is more useful when htop is started as root since regular users do not have access to this kind of incriminating information about other users/people's processes.

htop has quite a few other keyboard shortcuts available. A complete list as well as documentation is accessable within htop by pressing F1. The keyboard shortcuts can also be found in the htop manual.

Installation and Configuration[edit]

Most distributions have htop available as a package named htop making it easy to install it with dnf install htop or apt-get install htop depending on distribution. CentOS does not have the htop package in it's base repositories. It is in the optional EPEL repository; CentOS users can enable the EPEL repository and install htop with yum -y install htop.

htop's default view can be customized by pressing F2 ("Setup"). Changes made here are saved to $HOME/.config/htop/htoprc.

See also[edit]

Links[edit]

htop's homepage is at hisham.hm/htop/. The htop source repository is hosted at Microsoft GitHub.


Add your comment
LinuxReviews welcomes all comments. If you do not want to be anonymous, register or log in. It is free.