Linux VPS

Monitor processes with top and htop on Linux

Read top and htop on your Linux VPS: load average, CPU, memory and swap, sort by usage, find the process slowing the server and stop it safely.

BeginnerLinux VPS2 min read

When a VPS feels slow, top and htop show which processes use the CPU and memory right now. top is always installed; htop is friendlier, with colours, mouse support and easy sorting.

Before you start

  • SSH access (see connect with SSH).
  • Install htop: sudo apt install htop or sudo dnf install epel-release htop.

Read the header

  • Load average (1, 5, 15 minutes): processes waiting for CPU. Compare with your core count (nproc): a load of 4 on 4 cores is fully busy.
  • CPU %: us user apps, sy kernel, wa waiting for disk (high means slow storage or heavy I/O), st steal time taken by the host.
  • Memory: Linux uses spare RAM as cache, so look at available, not free.
  • Swap: steady swap use with low available RAM means you need more memory (see add a swap file).

Use top

top
KeyAction
P / MSort by CPU / memory
1Show each CPU core
uFilter by user
cShow full command lines
kKill a process by PID
qQuit

Use htop

htop

Click a column header (or press F6) to sort, F3 to search, F4 to filter, F5 for a tree view showing parent and child processes, F9 to send a signal, and F10 to quit.

Stop a runaway process

Prefer restarting the owning service (sudo systemctl restart php-fpm, see systemctl). For a stray process:

kill 12345
kill -9 12345

Plain kill asks it to exit cleanly; -9 forces it and can lose unsaved data.

One-shot snapshots

ps aux --sort=-%cpu | head -n 10
ps aux --sort=-%mem | head -n 10
free -h

Troubleshooting

  • High wa: disk-bound; check with iotop and look for backups or large queries.
  • High st: the host is busy; if it persists, contact support with timestamps.
  • Processes killed unexpectedly: the out-of-memory killer acted; check journalctl -k | grep -i oom.

Next steps

Was this guide helpful?

Still stuck?

Ask MdmHost AI for a quick answer, or open a ticket and our team will take a look. We are here 24/7.