How to install htop on Alpine Linux using apk

last updated in Categories , ,

I am a new user of Alpine Linux. How do I install htop on Alpine Linux using the apk command?

Introduction – htop is nothing but Interactive process viewer for Alpine Linux. 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 Alpine Linux.


How to install htop on Alpine Linux using apk

The procedure for installing htop on Alpine Linux is as follows:

  1. Open the terminal window.
  2. For remote Alpine Linux server login using ssh command.
  3. Execute apk search htop command to search for htop on Alpine
  4. Run apk add htop to install htop in Alpine Linux

Let us see all steps and command in details.

Alpine Linux install htop

Let us search for htop package using apk command:
apk search htop
Sample outputs:


Get information about htop package

Run the following command:
apk info htop
Sample outputs:

htop-2.2.0-r0 description:
Interactive process viewer

htop-2.2.0-r0 webpage:

htop-2.2.0-r0 installed size:

Install htop

Finally, type:
apk add htop

apk command install htop on Alpine Linux
Installing htop on Alpine Linux using apk

How to use htop command

The syntax is:
htop [options]

Running htop on an Alpine Linux server
htop in action

One can use a monochrome color scheme, run:
htop -C
htop --no-color

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

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

Limit and show process for only the given PIDs:
htop -p PID
htop -p PID1,PID2
htop -p 1342
htop -p 7435,1367

htop keyboard shortcut keys

The following commands are supported while in htop:

Up arrow keySelect (highlight) the previous process in the process list. Scroll the list if necessary.
Down arrow keySelect (highlight) the next process in the process list. Scroll the list if necessary.
Left arrow keyScroll the process list left.
Right arrow keyScroll the process list right.
PgUp, PgDnScroll the process list up or down one window.
HomeScroll to the top of the process list and select the first process.
EndScroll to the bottom of the process list and select the last process.
sTrace 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.
lDisplay open files for a process: if lsof(1) is installed, pressing this key will display the list of file descriptors opened by the process.
uShow only processes owned by a specified user.
MSort by memory usage (top compatibility key).
PSort by processor usage (top compatibility key).
TSort 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.
KHide kernel threads: prevent the threads belonging the kernel to be displayed in the process list. (This is a toggle key.)
HHide 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.)
pShow full paths to running programs, where applicable. (This is a toggle key.)
Ctrl-LRfresh the screen.
F1See this help menu.
hSame as above.
?Again, same as above.
F10Quit htop
qExit htop (same as above)

How to get help about htop

Simply type:
htop --help
man htop


This page showed you how to install and use htop on Alpine Linux. For more information see htop home page here.


Posted by: Vivek Gite

The author is the creator of nixCraft and a seasoned sysadmin, DevOps engineer, and a trainer for the Linux operating system/Unix shell scripting. Get the latest tutorials on SysAdmin, Linux/Unix and open source topics via RSS/XML feed or weekly email newsletter.

Start the discussion at

Historical Comment Archive

1 comment

    Still, have a question? Get help on our forum!