Linuxlab

Live monitoring in Linux: top and htop

Updated July 3, 2026

top and htop show a live list of processes, sorted by their CPU or memory load.

Common cases

top                  # a live list, q to quit
htop                 # friendlier: colour, scrolling, mouse
# inside top:
#   P  sort by CPU
#   M  sort by memory
#   k  send a signal to a process
ps aux --sort=-%cpu  # a snapshot: top by CPU, no live mode

How it works: a snapshot versus live mode

ps gives one snapshot and exits, while top and htop refresh every couple of seconds. That is what you need to catch what is loading the system. The top rows show a summary: the load average, CPU usage and memory. Below them are the processes, the greediest on top by default. htop is nicer than top: you can scroll the list, click a process and kill it, and per-core usage bars sit at the top. If htop is not installed, top is always there.

In the book

This topic is covered in full in the chapter Monitoring and bottlenecks.

See also

Viewing processes, Memory: free, Load average, The vmstat command.

Try it

Open the sandbox: a real throwaway Linux terminal in your browser. Run the commands above by hand - the container is deleted when you leave.