Search The Hostwinds Guides Knowledge Base

CentOS Install HTOP command line performance monitoring

Share This Article

With any Linux-based from Hostwinds, there may be a need to monitor your processes. htop provides you with an interactive way to monitor your processes for your server and can be used with any Hostwinds Cloud VPS server.

This guide will go over using htop on a Hostwinds Cloud VPS server running CentOS.

CentOS Install HTOP command line performance monitoring

Htop dashboard

What is HTOP?

htop is a command-line interface to check and monitor your servers performance. Essentially it is a dashboard that combines a number of different types of Linux commands to represent them in groups within this dashboard. Items such as CPU load, Memory usage overall, swap usage, tasks running, load averages, system uptime, and currently running processes. One of the nice things about Htop is that it accomplishes the goal of many command-line tools already within Linux. Htop is customizable which means you can change what is displayed and customize it to your needs.

Why Use Htop?

A lot of VPS users will install Webpanels such as CentOS Web Panel, VestaCP, and Virtualmin to manage their server via the web browser and SSH to the server accessing the command line. Having access to a visual aid in the command line can be a very insightful tool when monitoring your server, especially when trying to communicate potential issues to others in technical support roles, not to mention other interested stakeholders.

Installing Htop:

Step One: Select, Copy, and Paste this command set into your terminal session while logged in

Step Two: Enter your password when prompted

Step Three: Now that the installation is complete, type htop and press enter

Step Four: You now have htop installed by the looks of it, great job. Htop will also work for regular users.

Notice all the F key functions at the bottom of the screen.

Htop Function Keys
F1 Help

As pictured above htop has many options

In the F1 window we see there are many shortcut keys to work with:

Arrows – These up and down keys allow you to scroll up and down.
Digits – As in number keys allow you to type in a PID number to search
F3 – Incremental name search
F4 – Incremental name filtering
F5– Toggle Tree view
– tree view
p – toggle search path
H – hide or show user process threads
K – hide or show kernel threads
F – hide/show kernel threads

F6 + or expand and collapse tree
P M T– sort by CPU%, MEM%, or TIME
I – invert sort order
F6 >   .  select sort column

Space Bar– Tags a process
C – tags process and all of its children
U – untag all processes
F9  – kill processes or tags processes
F7   ] – higher priority (only works when logged in as root user)
F8   [ – lowers priority of process  just like (+nice)
a – sets a CPU affinity
e – shows the processes environment
i –  lowercase sets IO priority
I – capitol lists open files with lsof
s – trace syscalls with strace

F2   C    S- setup
F1 h – show this help screen
F10 q – quit

F2 Setup. Using the Setup feature you can customize your Htop dashboard with the options listed here. Set your colors, the graphs, columns, and monitor options.
F3 Search
I filters my processes looking for dovecot
F4 Filter your process list
Sort your process list
F5 Sorted
F6 Collapse a group of processes
F6 collapsed dovecot process group

F7 and F8 to change the Nice values, what does that mean?

A Linux nice value is a priority value with -20 being the highest and 19 the lowest priority.

The nice command allows you to manually manage the CPU scheduling priority of each process.

Changing the Nice values using the F7 and F8 Function keys.
F9 to Kill Selected processes listed in the dashboard. Notice on the left hand side of the screen you can send killsignals with different options. Step 1, select the kill signal usually -9 to kill run aways and zombie processes, once selected press enter, then select the process to send the kill signal to, and again press enter

Selecting F10 will exit Htop back to the command prompt.

Related Articles: