Monday, August 20, 2018

What's on TOP of your mind? :)

When it comes to Linux, people who are used to Windows or GUI-rich OS, often find Linux commands or command output a bit of encrypted at first look.
Take "TOP" for instance:
top - 23:01:42 up 101 days, 19:29, 6 users, load average: 0.40, 0.34, 0.23
Tasks: 1810 total,  1 running, 1807 sleeping,  0 stopped,  2 zombie
Cpu(s): 0.2%us, 0.1%sy, 0.0%ni, 99.6%id, 0.0%wa, 0.0%hi, 0.0%si, 0.0%st
Mem: 264401092k total, 130649152k used, 133751940k free, 1245060k buffers
Swap: 33554428k total,    0k used, 33554428k free, 95522700k cached
 PID USER   PR NI VIRT RES SHR S %CPU %MEM  TIME+ COMMAND       
12782 mysql   20  0 24.1g 12g 9564 S 4.0 5.2  3142:56 mysqld       
51796 root   20  0   0  0  0 Z 1.7 0.0  0:00.05 perl    
51795 root   20  0   0  0  0 Z 1.3 0.0  0:00.04 perl    
51783 localgrp  20  0 16380 2592 944 R 1.0 0.0  0:00.07 top         
45469 qui    20  0 11.4g 472m 22m S 0.7 0.2 103:35.57 java        
46019 qui    20  0 9678m 640m 22m S 0.7 0.2 262:27.61 java 
NO worry; google can help. Or Here is a quick cheatsheet ...
us: user cpu time (or) % CPU time spent in user space
sy: system cpu time (or) % CPU time spent in kernel space
ni: user nice cpu time (or) % CPU time spent on low priority processes
id: idle cpu time (or) % CPU time spent idle
wa: io wait cpu time (or) % CPU time spent in wait (on disk)
hi: hardware irq (or) % CPU time spent servicing/handling hardware interrupts
si: software irq (or) % CPU time spent servicing/handling software interrupts
st: steal time - - % CPU time in involuntary wait by virtual cpu while hypervisor is servicing another processor (or) % CPU time stolen from a virtual machine
What if I want to save my TOP output to a text file for later debugging?
1) top -n 1 -b > /tmp/myTop_output_mmddYYYY.txt
2) top -n 10 # run 10 repetition

0 Comments:

Post a Comment

<< Home