Thuta Learning
AdvancedDevOps & Toolsbeginner

Process 101: ps, top, htop

Relax. We'll talk through this in plain words — no textbook voice.

What you'll walk away with

  • Understand Process 101: ps, top, htop without any of the intimidation
  • Get hands-on practice trying out the commands yourself in the terminal
  • See how these commands actually come in handy on a real server or project

Let's think about it this way for a second

A process is simply a program that's currently running — each one gets assigned a number called a PID (Process ID). Running ps aux shows a snapshot (a photo taken at one moment in time) of every process running on the system — the columns include things like PID, %CPU, %MEM, and COMMAND. top, on the other hand, isn't a snapshot — it's a command that shows a live, real-time update, with the process eating up the most CPU/memory shown at the top; you exit it by pressing q. htop is basically an upgraded version of top — with color, scrolling, and mouse clicks, it's much easier to use (though you'll need to install it, since it's not there by default).

Let's connect this to a real-world scenario

If you get the feeling 'the server is acting sluggish,' open top and check the %CPU column — if a process at the top is hogging a ton of resources, that's likely the source of the problem. Running ps aux | grep nginx will catch every process belonging to the nginx web server — this is another real-world scenario where you'll run into pipes again. If you want to install htop, use sudo apt install htop (we'll cover package management in more depth in the next chapter).

Let's try it together in the terminal

bash
ps aux
ps aux | grep nginx
top           # q နှိပ်ပြီးထွက်
htop          # install: sudo apt install htop
You should see
Running ps aux produces a table with PID, USER, %CPU, %MEM, and COMMAND columns.

5-minute try-it

Run top and try it out. Note down which two processes are eating the most CPU/memory, then exit with q.

A quick word of caution

You can kill a process right from inside top/htop with the 'k' key, but as a beginner, be careful not to accidentally kill a system process from there — we'll cover kill in detail in a later chapter.

Easy traps

  • Not knowing how to exit top and closing the whole terminal instead — just press q
  • Mixing up the PID column with the %CPU column in ps aux output

Now try it yourself

Run top and try it out. Note down which two processes are eating the most CPU/memory, then exit with q.

You'll know it worked when: Running ps aux produces a table with PID, USER, %CPU, %MEM, and COMMAND columns.