Real-time Monitoring with Top: A Developer's Guide to Performance
Master real-time system monitoring with top and htop. Learn to interpret CPU and memory usage, identify resource bottlenecks, and manage process performance.

Previously in this course, we covered the introduction to processes, where you learned how to list PIDs and understand the hierarchy of running applications. In this lesson, we move from static process lists to dynamic, real-time observability.
When your web server becomes sluggish or a service starts consuming excessive memory, you need a live view of the system. We use top and htop for this exact purpose—they are the standard tools for monitoring system performance and identifying immediate resource bottlenecks.
Launching and Interpreting top
The top command comes pre-installed on virtually every Linux distribution. It provides a real-time summary of the system and a list of processes currently managed by the kernel.
To start it, simply run:
Bashtop
The screen is divided into two parts:
- The Summary Area (Header): Shows system uptime, load averages (1, 5, and 15 minutes), total task count, CPU percentages, and memory (RAM/Swap) usage.
- The Task List: A table showing individual processes, their user, priority, and resource consumption.
Reading the Metrics
- Load Average: These three numbers represent the average number of processes waiting for CPU time. If your system has 4 CPU cores, a load average above 4.00 means your system is effectively overloaded.
- %CPU: The percentage of total CPU time used by a process.
- %MEM: The percentage of physical RAM used by a process.
- RES: The "Resident" memory—the actual physical RAM the process is using right now.
Introducing htop for Better Visibility

While top is ubiquitous, htop is a modern, interactive improvement that makes system monitoring far more intuitive. It features color-coded bars for CPU/Memory and allows you to use your mouse or arrow keys to navigate.
If it's not installed, you can typically grab it via sudo apt install htop (on Debian/Ubuntu systems). Launch it with:
Bashhtop
Key Differences
| Feature | top | htop |
|---|---|---|
| Interaction | Basic (Keyboard only) | Advanced (Mouse + Keyboard) |
| Visualization | Text-based | Bar graphs for CPU/RAM |
| Process Tree | Limited | Built-in tree view (F5) |
| Sorting | Specific keys | Interactive clicking |
Sorting and Filtering Processes
To effectively troubleshoot, you need to see who is hogging the resources. You don't need to guess; you can sort the list dynamically.
Inside top:
- Sort by CPU: Press
P(capitalized, soShift+p). The most resource-intensive processes will jump to the top. - Sort by Memory: Press
M. - Change refresh rate: Press
sand enter a new number of seconds.
Inside htop:
- Sort: Click on the column headers (e.g.,
PERCENT_CPU) with your mouse, or pressF6to select a sorting column from a menu. - Search: Press
F3to filter the process list by name (e.g., typing "nginx" to see only your web server processes). - Kill: Press
F9to send a signal to a highlighted process (we will cover this in detail in the next lesson).
Hands-on Exercise: Identifying Load
- Open two terminal windows.
- In the first, run
htop. - In the second, run a command that consumes some CPU, such as
find / -name "*.log"to trigger disk and CPU activity. - Observe the change in the CPU bars in
htop. - Press
F3inhtopand type the name of the command you just ran to isolate its impact. - Once finished, press
qto exithtop.
Common Pitfalls

- Misinterpreting "Load": A high load average isn't always bad. If your system is performing a heavy background task intentionally, high load is expected. Only investigate if the load is high and the system becomes unresponsive.
- Ignoring Swap: If you see
Swapusage climbing in the header, your system is running out of physical RAM and is writing data to the hard drive, which is significantly slower. This is usually a sign that your server needs more memory or a process has a memory leak. - Not Using
sudo: You can see all processes withtoporhtopas a standard user, but you won't have permission to perform actions like changing priorities or killing processes owned by other users or the system.
If you find yourself frequently checking these tools, you are likely hitting the limits of your hardware. Understanding these metrics is a prerequisite for effective Linux performance monitoring: a practical guide to htop & iostat, which helps you bridge the gap between process monitoring and disk I/O analysis.
Up next: We will discuss how to actually stop those resource-heavy processes using the kill command.
Work with me

React & Next.js Dashboard / Admin UI Development
A clean, data-rich dashboard UI in React or Next.js — charts, tables, and real-time data that your users will actually enjoy using.

Next.js E-commerce Store Development
Turn your Facebook page or small shop into a real online store — fast, mobile-first, and built to sell. Own your storefront, not just a social page.

