Ask Steves · Daily notes · VPS, 20% off · AI Profit Lab · SEO · Money Hub

17 September 2026 · One command a day

How do I watch CPU and memory per process on Linux?

htop is an interactive process viewer. It shows every process on the server with its CPU and memory use, updates every second or two, and lets you sort and filter with a few keys. You reach for it when the server feels slow and you want to know which app is responsible, or when memory is filling up and you need to see what is holding it.

The command

htop

There are no required flags. The program opens full screen and keeps running until you press q. The most useful keys once it is open are F6 to pick a sort column, F5 to switch to a tree view that groups child processes under their parent, F4 to filter by name, and H to hide threads. You can also set the sort order on the way in. htop -s PERCENT_MEM starts sorted by memory, and htop -u www-data shows only processes owned by one user.

What you will see

  0[||||||                        12.4%]   Tasks: 214, 611 thr; 2 running
  1[|||                            6.1%]   Load average: 0.84 0.61 0.55
  2[||||||||||                    21.0%]   Uptime: 41 days, 03:12:48
  3[||                             3.9%]
  Mem[||||||||||||||||        11.2G/31.3G]
  Swp[                              0K/0K]

  PID USER      PRI  NI  VIRT   RES   SHR S CPU% MEM%   TIME+  Command
 1842 appuser    20   0 1123M  412M 38912 S 14.2  1.3 12:41.03 node /var/www/appname/server.js
  911 mysql      20   0 2841M  962M 22016 S  0.7  3.0 88:32.41 /usr/sbin/mariadbd
 3390 root       20   0 2210M  380M 42112 S  1.4  1.2 55:10.19 dockerd
 2107 www-data   20   0 71204 24560 12844 S  2.1  0.1  3:05.77 nginx: worker process

The bars at the top show each CPU core, then total memory and swap. Below that is one line per process. CPU% is the share of one core, so a process can show more than 100% on a multi-core box. RES is the memory the process actually has in RAM and is the number to trust. MEM% is that figure as a share of total RAM. The Command column shows the full command line, which is how you tell one Node app from another. The load average tells you how many processes were waiting for CPU on average over the last 1, 5 and 15 minutes. On a 4 core server, anything under 4 is comfortable.

When to use it

Watch out for

By default htop shows threads as well as processes, so a single Node app can appear as a dozen lines with the same command. The thread lines are shown in a different colour, but it is easy to think an app has spawned copies of itself. Press H to hide threads and the list collapses to one line per real process. If you use a process manager, the names in htop will match what PM2 lists, so you can cross-check.

Questions people ask

Is htop installed by default on Ubuntu 24.04?

Most Ubuntu Server images include it, but not all VPS templates do. If the command is not found, run sudo apt install htop.

What is the difference between htop and top?

top is on every Linux system and gives the same data in a plainer form. htop adds colour, scrolling, mouse support and simple sorting and filtering, which makes it far quicker to read.

Seeing exactly which process is using your CPU and memory, and acting on it, is only possible on a server you control. You can get the same VPS with 20% off at https://asksteves.co.uk/vps. Affiliate link.

Everything on this blog runs on one Hostinger KVM 8. This link takes 20% off the same box.

GET A VPS, 20% OFF →

Affiliate link.

More daily notes: How do I check memory usage on a Linux server? · How do I find what is using disk space on Linux? · How do I check disk space on a Linux server?