🔍 Why use htop?
When your server slows down or you want to monitor the system activity in real-time, htop is a simple, effective, and visual tool. It’s a modern alternative to the top command.
With htop, you can:
- View CPU, memory, and swap usage
- Identify resource-intensive processes
- Sort, filter, and kill processes easily
- Use a colorful, interactive, and clear interface
🛠️ Installing htop
➤ On Debian / Ubuntu:
sudo apt update
sudo apt install htop
➤ On CentOS / RHEL / Fedora:
sudo dnf install htop # or 'yum install htop' on CentOS 7
👁️🗨️ Understanding the htop interface
Simply run:
htop
You’ll see an interface split into two parts:
🧠 At the top:
- Colored CPU bars: each core is shown
- RAM and Swap usage
- Uptime: how long the system has been running
📋 At the bottom:
A list of running processes with:
PID: process IDUSER: who is running the process%CPUand%MEM: resource usageCOMMAND: the command executed
🛠️ Useful Features in htop
- Sort: press
F6to choose sorting criteria (CPU, memory, etc.) - Kill a process: use arrow keys to select, then press
F9 - Search a process:
F3and type the name - Show threads: press
H - Tree view: press
F5to toggle - Customize display:
F2to configure colors, columns, etc.
🧪 Real-world example: “My server is slow…”
You SSH into your server and type htop:
- Is an app using 100% of the CPU? You’ll spot it easily.
- High memory usage? Maybe
apache2ormysqlis misconfigured. - Zombie processes? You’ll see them too.
🚀 Alternatives to htop
If you like htop, you might also enjoy:
| Tool | Description |
|---|---|
glances |
More complete view with auto-refresh |
atop |
Detailed performance audits |
bpytop |
Python version with colorful interface |
nmon |
Popular in production environments |
Install glances:
sudo apt install glances # Debian/Ubuntu
sudo dnf install glances # CentOS/RHEL
✅ Conclusion
htop is one of the easiest tools to quickly understand what’s happening on your server. Whether you’re a beginner or an experienced sysadmin, it’s an essential daily companion.