Master Linux System Monitoring: A Deep Dive into Every Line of the top Command
This article walks readers through each section of the top command output—system overview, process list, CPU, memory, and I/O metrics—explaining what the values mean, how to interpret warnings, and which interactive shortcuts and command-line options help quickly pinpoint performance bottlenecks.
1. Interface Overview: Reading System Vital Signs
The top command screen is divided into several key sections, each line revealing a specific aspect of system state.
Line 1 – System Overview : Shows current time (e.g., 10:00:00), uptime (e.g., up 122 days, 10:30), number of logged‑in users, and load average (e.g., 0.08, 0.06, 0.06). Load average indicates the average number of runnable or uninterruptible processes over the last 1, 5, and 15 minutes; a value above 1.0 on a single‑core CPU means processes are queuing.
Line 2 – Process Summary : Displays total tasks, how many are running, sleeping, stopped, or zombie. A non‑zero zombie count signals terminated processes that have not been reaped.
Line 3 – CPU Usage : %us (user space), %sy (kernel space), %id (idle), %wa (I/O wait), %st (steal time). High %wa points to disk or network I/O bottlenecks; high %st on virtualized hosts indicates the VM is losing CPU to other guests.
Lines 4‑5 – Memory and Swap : Total, used, free, and cached memory are listed; swap used indicates memory pressure. The article stresses that “actual available memory ≈ free + buffers + cached”.
2. Process List – Resource Consumption Ranking
The lower part of top lists processes sorted by the selected column. Important columns include:
PID : Process identifier, used with commands such as kill.
USER : Owner of the process.
%CPU / %MEM : Percentage of CPU and memory used, useful for spotting the biggest consumers.
VIRT : Virtual memory size.
RES : Resident physical memory – the actual RAM the process occupies.
SHR : Shared memory size.
S : Process state (R=running, S=sleeping, D=uninterruptible, Z=zombie).
COMMAND : Command line that started the process.
3. Efficient Usage Tips
Interactive sorting shortcuts : Press P to sort by CPU usage descending, M for memory usage descending, and T for CPU time descending.
Useful command‑line options : top -p PID1,PID2,… – monitor only the specified PIDs. top -d 5 – change the refresh interval to 5 seconds (default is 3 seconds). top -H -p PID – display all threads of a given process; helpful for locating high‑CPU Java threads, whose IDs can be converted to hexadecimal and matched in a jstack log.
4. Summary – From “Knowing How” to Mastery
Beyond a quick glance at CPU percentage, top provides early warnings: high %wa suggests I/O bottlenecks; zombie processes indicate possible application bugs; high %st may reveal noisy neighbors in cloud environments. The article recommends practicing by running top, using the described shortcuts, and correlating the output with the explanations to develop an intuitive sense of system health.
Signed-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
Linux Tech Enthusiast
Focused on sharing practical Linux technology content, covering Linux fundamentals, applications, tools, as well as databases, operating systems, network security, and other technical knowledge.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
