How to install htop on Debian Linux using apt-get

last updated in Categories , ,

I am a new user of Debian operating system. How do I install htop on Debian using the apt command or apt-get command?

htop is nothing but Interactive process viewer for Debian Linux system. It is just like default top command with an additional set of options and better colorful display on the screen. Very useful for developers and new system users. This page shows how to install htop on Debian using command line options.


How to install htop on Debian using apt-get

The procedure for installing htop Debian is as follows:

  1. Open the terminal application.
  2. For remote Debian server login using ssh command.
  3. Execute apt search htop command to search for htop on Debian
  4. Run sudo apt install htop to install htop in Debian

Let us see all commands and step-by-step- examples in details.

Please note that admin@ls-debian-10:$ is my shell prompt. You need to type all commands after that prompt.

Debian 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 apt command:
admin@ls-debian-10:$ apt search htop
## OR use the apt-cache command ##
admin@ls-debian-10:$ apt-cache search htop

aha - ANSI color to HTML converter
<span style='color: rgb(0, 153, 0);'>htop - interactive processes viewer</span>
libauthen-oath-perl - Perl module for OATH One Time Passwords
pftools - build and search protein and DNA generalized profiles

Find information about htop package

Run the following command:
admin@ls-debian-10:$ apt info htop
Debian 10 getting info about htop

Installing htop on Debian

First, make sure you system is up to date and all patches are installed on Debian 10 Linux box and then install htop:
admin@ls-debian-10:$ sudo pkg update && sudo apt upgrade
Finally, run the following to install htop on Debian:
admin@ls-debian-10:$ sudo apt install htop
Install htop on Debian using pkg command

How to use htop command

The syntax is:
htop [options]
htop [options] arg1 arg2

Running htop on Debian Linux 8, 9 and 10 cloud server
Please note that you need to press the F10 or q key to exit from htop session.

Use a monochrome color scheme, run:

admin@ls-debian-10:$ htop -C
admin@ls-debian-10:$ htop --no-color

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

admin@ls-debian-10:$ htop -t
admin@ls-debian-10:$ htop --tree

htop tree outputs
Let us see only processes of a given user named sayali or tom:
admin@ls-debian-10:$ htop -u sayali
admin@ls-debian-10:$ htop -u tom
admin@ls-debian-10:$ htop --user=vivek
## see all process owned and run by 'www-data' user on the server ##
admin@ls-debian-10:$ htop --user=www-data

Limit and show process for only the given PIDs:
admin@ls-debian-10:$ htop -p PID
admin@ls-debian-10:$ htop -p PID1,PID2,PID3
admin@ls-debian-10:$ htop --pid=PID1,[,PID2,PID3,...]
admin@ls-debian-10:$ htop -p 4242
admin@ls-debian-10:$ htop -p 1313,1399,6666

Debian htop keyboard shortcut keys

The following commands are supported while in htop intractive mode:

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.

Other keyboard shortcuts

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-LRefresh the screen.
F1See this help menu.

How to get help about htop

Simply pass the --help option. For example:
admin@ls-debian-10:$ htop --help
admin@ls-debian-10:$ man htop


In this quick tutorial, we explained how to install and use htop on Debian Linux server. It has many more option. Hence, see the htop home page online here or read man page.


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!