Understanding Linux top command results. As a Linux system administrator, the top command is a frequently used command and our daily tasks we used multiple times this commands to view resource utilization by processes on the server. This command helps us to find which process is utilizing what resources of the system.
- Sysstat – Linux System Performance Monitoring Tool
- Glances – A Real-Time Linux System Monitoring Tool
Using this article, I am trying to write to how to use to command and understand the results of top command on the Linux system
How to Read Linux Top Command Output
When you execute the top command on Linux, it shows a lot of results, here I am trying to show you to how to read it row by row.
Result Row #1
The Row 1 results show about server uptime from the last reboot, currently logged in users and CPU load on the server. The same output you can find using Linux
Result Row #2
Row 2 shows the number of process running on the server and their state.
Result Row #3
Row three shows the CPU utilization status on the server, you can find here how much CPU is free and how much is utilizing by the system.
Steal time is the time that a virtual CPU waits for a real CPU while the hypervisor is servicing another virtual processor.
Definition from access.redhat.com
Result Row #4
Row 4 shows the memory utilization on the server, you can find here how much memory is used, the same results you can find using
Result Row #5
Row 5 shows the swap memory utilization on the server, you can find here how much swap is being used, the same results you can find using
Result Row #6 ( Running Processes )
In this steps you will see all running process on servers and there additional details about them like below.
Short Results Based on Specific Fields
You can also sort the results based on the specific field. Use the following key combination to do short.
Press "SHIFT + F " and Select your choice below and pressENTER .A ( PID = Process Id )b ( PPID = Parent Process Pid )d ( UID= User Id )e ( USER = User Name )f ( GROUP = Group Name )g ( TTY= Controlling Tty )h ( PR = Priority )i ( NI = Nice value )j ( P = Last used cpu (SMP) )k ( %CPU = CPU usage )l ( TIME = CPU Time )n ( %MEM = Memory usage (RES) )o ( VIRT = Virtual Image (kb) )p ( SWAP = Swapped size (kb) )q ( RES= Resident size (kb) )r ( CODE = Code size (kb) )s ( DATA = Data+Stack size (kb) )t ( SHR= Shared Mem size (kb) )w ( S = Process Status )x ( COMMAND= Command name/line )
16 Comments
nicely explain.
Excellent way of explaining. Really useful
Clear and crisp. Thank you Rahul
Row #2 and Row #3 are same, whereas Row #2 should be Tasks and Row #3 should be CPU(s)
Hi
Please check the typo mistake.(in row3 last line ni–>st).this one helped me much.
Thank you,
siva kumar reddy.
Thanks Siva, Image has been updated.
Neat work and well explained. Thank you for this KM.
Very informative , thanks for sharing it.
Awesome explanation, however %ni has been repeated twice which should be %st : steal time in the CPU Usage Section. Please correct it.
Thanks
Abhimanyu Singh
Very nice explanation but some more description of fields
You are missing a key point or am i?
In result row #1 you have the load averge of cpu time in 1min, 5min and 15min.
Results are:
3.48 @ 1min.
4.98 @ 5min.
4.11 @ 15min.
but what those there number mean.? it cannot be a readout of the CPU load averge over 1min, you CPU would be idle most of the time if the averge load is 3.48, on my linux machine this number is less than 1.
So wtf is it?!?!?.
Well it’s not like your Windows friendly view, it’s linux and thank god.
It’s hard to explain and maybe someone else can do it better but here goes.
Lets say your system is running with a 4 core CPU, on a Windows PC you would see the 4 cores and the average load each sec.
You can’t simply move one thing to another core, just like you can’t walk through two doors at the same time.
However my wife would arguing this.
We can’t do two things at the same time, but if we have two doors, why not send one thing through one door and another through the next and so on.
Btw a CPU with hyperthreading is not a core…!
So lets say it’s a 4 core CPU, and we have the same average load of 3.48 the first minute, then 4.98 every 5 minute and 4.11 every 15minute.
We can translate this to 3 of the cores are at 100% load, and one if at 48%.
However this is not true, as we cannot see each core, but the totalt amount so we can only guess.
This should tell you that there is still a good 52% left on one core, and we don’t need to raise an alarm depending on the average load every 5 or 15min.
Now every 5min we have a load over 4. It’s 4.98 and i lost you again.
If we have 4 core where every core can max at 1 why do we have above 4 on a 4 core system?
Well this counter is so much more, it’s current load or a givin load over a time, it’s the amount the system would like to utilize over a givin periode of time.
WTF.! stop plz.
Yeah i know, if only it was Windows and we could all die in a puddel of licens.
Install htop, it would give you a more “user friendly” view.
On debian you should just apt-get install htop
redhat users should add repoforge anyway.
Now that we know our system is overloaded, how can we fix it?
By using top to see what is hooking all the CPU time.
Hope you can update you’re guide to include what these numbers mean as they are not the amount of CPU load in %
You can find this number on a linux machine with this command cat /proc/cpuinfo | grep ‘model name’ | wc -l
Hey,
This article seems to basic informative with variable explanations within top command, why are you arguing with load values. Also please specify why your are specifying overload with 4 core! Does the article mentioned in such a way!!!
Last but not least, Please do manner in your replies….:)
Nice explanation. people can understand very easily even he/she does not know.
Very nice explanation but still you can explain in detail about swap size,cached size,Buffer size etc..
u given a clear explanation, so please update the other commands also like this.
Very nice and clearly explained…… thanks for sharing this…..