Beyond the basics covered in How to Check VPS Resource Usage, several command-line tools provide deeper, more actionable real-time insight without needing a full monitoring stack.
htop: Interactive Process Viewer
sudo apt install htop -y
htop
Key features beyond basic top:
- Color-coded, scrollable process list
- Tree view (
F5) showing parent-child process relationships - Search (
F3) and filter (F4) processes by name - Sort by any column (
F6) - Kill processes directly (
F9)
glances: All-in-One System Overview
sudo apt install glances -y
glances
Combines CPU, memory, disk, network, and per-process data into a single unified view — useful as a quick "everything at once" check without switching between multiple tools.
Run as a web server for remote access:
glances -w
http://YOUR_SERVER_IP:61208
Restrict this to trusted IPs at the firewall level, same as any other monitoring dashboard.
dstat: Detailed Resource Statistics Over Time
sudo apt install dstat -y
dstat -cdngy
Shows CPU, disk, network, and system stats side by side in a continuously updating table — useful for spotting correlations (e.g. disk I/O spiking exactly when network traffic spikes).
vmstat: Virtual Memory Statistics
vmstat 1 10
Particularly useful for spotting swap activity (si/so columns) and context switching rates that might indicate CPU contention.
iotop: Per-Process Disk I/O
sudo apt install iotop -y
sudo iotop -oa
Shows exactly which process is generating disk read/write activity — essential when iostat shows high I/O wait but you need to identify the specific culprit.
nethogs: Per-Process Network Usage
sudo apt install nethogs -y
sudo nethogs
Shows bandwidth consumption broken down by process, rather than just total interface throughput — useful for identifying which specific application is consuming bandwidth.
Choosing the Right Tool for the Situation
| Question | Best Tool |
|---|---|
| What process is using the most CPU right now? | htop |
| Quick overview of everything at once | glances |
| Is the system swapping? | vmstat |
| Which process is causing high disk I/O? | iotop |
| Which process is using the most bandwidth? | nethogs |
Best Practices
- Keep these lightweight CLI tools installed even if you also run a full monitoring stack — they're invaluable for quick, immediate diagnosis during an active incident
- Restrict any web-exposed monitoring interface (like glances -w) to trusted IPs
- Learn htop's keyboard shortcuts — it dramatically speeds up interactive troubleshooting
Related Articles
- How to Check VPS Resource Usage (CPU, RAM & Disk)
- How to Fix High Disk I/O Wait Issues
- How to Diagnose and Fix High CPU Usage on a VPS
