1. What Is top?
top is a terminal-based program that displays dynamic, real-time information about system activity. It helps system administrators identify high-resource processes and monitor overall system health.
2. Running top
Usually preinstalled in most Linux distributions, you can launch it with:
top3. Basic top Output
- uptime: Duration the system has been running
- load average: System load over the past 1, 5, and 15 minutes
- Tasks: Total number of processes (running, sleeping, stopped)
- CPU usage: Percent CPU used by user/system/idle
- Memory: RAM usage breakdown
- Swap: Swap memory usage
4. Interactive Control Keys
| Key | Function |
|---|---|
| h | Display help screen |
| k | Kill a process (enter PID) |
| r | Renice a process |
| u | Filter by user |
| n / # | Set number of processes to show |
| q | Quit top |
5. Useful Command-Line Options
- -d: Refresh interval in seconds
top -d 3
top -u jina
top -p 1234,5678
6. Sorting Within top
P– Sort by CPU usageM– Sort by memory usageT– Sort by time running
7. Enhanced Alternative: htop
htop offers a more user-friendly and graphical interface:
sudo apt install htop
htop8. Practical Use Cases
- Identify CPU-intensive processes
- Monitor RAM usage trends
- Kill or renice unresponsive processes
- Investigate system slowdowns
9. Conclusion
top is a foundational Linux tool for understanding what’s consuming system resources in real time. With its keyboard shortcuts and configurable options, it empowers administrators to detect performance bottlenecks and manage processes effectively.