How to install htop on OpenBSD

I am a new user of OpenBSD operating system. How do I install htop on OpenBSD using the pkg_add command?

htop is nothing but Interactive process viewer for OpenBSD based system. It is just like default top command with an additional set of options and better display on the screen. This page shows how to install htop on OpenBSD using command line options.

ADVERTISEMENTS

How to install htop on OpenBSD using pkg_add

The procedure for installing htop OpenBSD is as follows:

  1. Open the terminal window.
  2. For remote OpenBSD server login using ssh command.
  3. Execute pkg_info search htop command to search for htop on OpenBSD
  4. Run doas pkg_add install htop to install htop in OpenBSD

Let us see all steps and examples in details.

Please note that obsd-nixcraft# is my shell prompt. You need to type all commands after that prompt.

OpenBSD install htop

It is important that you know how to search for any packages. Therefore type the following command to search for htop package using pkg_info command:
obsd-nixcraft# pkg_info search htop
Sample outputs:

Information for https://cdn.openbsd.org/pub/OpenBSD/6.5/packages/amd64/htop-2.2.0p8.tgz

Comment:
interactive process viewer

Description:
htop is an interactive process viewer for Unix systems.

Maintainer: Ian Sutton <ian@ce.gl>

WWW: https://hisham.hm/htop/index.php

Installing htop on OpenBSD

First, make sure you system is up to date:
obsd-nixcraft$ doas pkg_add -u
Sample outputs:

quirks-3.124 signed on 2019-09-12T16:12:04Z
bzip2-1.0.6p9->1.0.6p10: ok
vim-8.1.1048-no_x11->8.1.1048p0-no_x11: ok
wget-1.20.2->1.20.3: ok
Read shared items: ok

Finally, run the following to install htop on OpenBSD:
obsd-nixcraft$ doas pkg_add -v htop

Command to Install htop on OpenBSD

Installing htop on OpenBSD

How to use htop command

The syntax is as follows on Unix server or desktop:
htop
htop [options] htop [options] arg

htop in action

htop in action

Press F10 or q to quit htop session.

One can use a monochrome color scheme, run:

obsd-nixcraft# htop -C
obsd-nixcraft# htop --no-color

Want to see the tree view by default when running htop? Try:

obsd-nixcraft# htop -t
obsd-nixcraft# htop --tree

Let us see only processes of a given user named vivek:
obsd-nixcraft# htop -u vivek
obsd-nixcraft# htop --user=vivek
obsd-nixcraft# htop --user=nginx

Limit and show process for only the given PIDs:
obsd-nixcraft# htop -p PID
obsd-nixcraft# htop -p PID1,PID2
obsd-nixcraft# htop --pid=PID,[,PID,PID...] obsd-nixcraft# htop -p 4617
obsd-nixcraft# htop -p 1122,4433,55768

OpenBSD htop keyboard shortcut keys

The following commands are supported while in htop:

Command Description
Up arrow key Select (highlight) the previous process in the process list. Scroll the list if necessary.
Down arrow key Select (highlight) the next process in the process list. Scroll the list if necessary.
Left arrow key Scroll the process list left.
Right arrow key Scroll the process list right.
PgUp, PgDn Scroll the process list up or down one window.
Home Scroll to the top of the process list and select the first process.
End Scroll to the bottom of the process list and select the last process.
s Trace process system calls: if strace(1) is installed, pressing this key will attach it to the currently selected process, presenting a live update of system calls issued by the process.
l Display open files for a process: if lsof(1) is installed, pressing this key will display the list of file descriptors opened by the process.

Other keyboard shortcuts

u Show only processes owned by a specified user.
M Sort by memory usage (top compatibility key).
P Sort by processor usage (top compatibility key).
T Sort by time (top compatibility key).
F “Follow” process: if the sort order causes the currently selected process to move in the list, make the selection bar follow it. This is useful for monitoring a process: this way, you can keep a process always visible on screen. When a movement key is used, “follow” loses effect.
K Hide kernel threads: prevent the threads belonging the kernel to be displayed in the process list. (This is a toggle key.)
H Hide user threads: on systems that represent them differently than ordinary processes (such as recent NPTL-based systems), this can hide threads from userspace processes in the process list. (This is a toggle key.)
p Show full paths to running programs, where applicable. (This is a toggle key.)
Ctrl-L Rfresh the screen.
F1 See this help menu.

How to get help about htop

Simply pass the --help option. For example:
obsd-nixcraft$ htop --help
obsd-nixcraft$ man htop

Conclusion

This page showed you how to install and use htop on OpenBSD Unix server. It has many more option. Hence, see the htop home page online here or read man page.

This entry is 0 of 0 in the series. Keep reading the rest of the series:
    🐧 Get the latest tutorials on SysAdmin, Linux/Unix, Open Source/DevOps topics:
    CategoryList of Unix and Linux commands
    File Managementcat
    FirewallAlpine Awall CentOS 8 OpenSUSE RHEL 8 Ubuntu 16.04 Ubuntu 18.04 Ubuntu 20.04
    Network Utilitiesdig host ip nmap
    OpenVPNCentOS 7 CentOS 8 Debian 10 Debian 8/9 Ubuntu 18.04 Ubuntu 20.04
    Package Managerapk apt
    Processes Managementbg chroot cron disown fg jobs killall kill pidof pstree pwdx time
    Searchinggrep whereis which
    User Informationgroups id lastcomm last lid/libuser-lid logname members users whoami who w
    WireGuard VPNAlpine CentOS 8 Debian 10 Firewall Ubuntu 20.04

    ADVERTISEMENTS

    Comments on this entry are closed.

    Use HTML <pre>...</pre>, <code>...</code> and <kbd>...</kbd> for code samples.