Introduction
Monitoring system performance is crucial for maintaining a healthy and responsive Ubuntu Server. Whether you’re troubleshooting issues or optimizing resource usage, tools like htop, top, vmstat, and iotop provide valuable insights into your system’s performance.
1. Using htop for Real-Time Monitoring
htop is an interactive process viewer that provides a more user-friendly alternative to the traditional top
command.
Installation:
Run the following command to install htop:

sudo apt update && sudo apt install htop -y
Key Features of htop:
- Displays CPU, memory, and swap usage in real time
- Allows process management (kill, renice) with simple keypresses
- Uses color-coded visualization for better readability
To launch htop, simply type:
htop
Use arrow keys to navigate and F9 to kill processes if needed.
2. Using top for Basic System Monitoring
The top
command is a built-in tool that provides a quick overview of system resource usage. It’s useful when you need a lightweight monitoring solution.
To start it, run:
top
Press q to exit, M to sort by memory usage, and P to sort by CPU usage.
3. Monitoring Disk I/O with iotop
If you suspect high disk usage is affecting performance, iotop
helps track which processes are using the most disk I/O.
Installation:

sudo apt install iotop -y
Usage:
sudo iotop
This will display real-time disk activity, helping identify performance bottlenecks.
4. Using vmstat for System Performance Analysis
The vmstat
command provides system performance statistics, including CPU usage, memory, and I/O activity.
Installation:
sudo apt install sysstat -y
Usage:

vmstat 2 5
This runs vmstat
every 2 seconds for a total of 5 times, giving an overview of performance trends.
Conclusion
Using tools like htop, top, iotop, and vmstat, you can effectively monitor and optimize your Ubuntu Server’s performance. Regular monitoring helps detect issues early, ensuring smooth server operations.