{"id":226,"date":"2012-06-12T11:59:38","date_gmt":"2012-06-12T03:59:38","guid":{"rendered":"http:\/\/rmohan.com\/?p=226"},"modified":"2012-06-12T11:59:38","modified_gmt":"2012-06-12T03:59:38","slug":"linux-system-monitoring-commands","status":"publish","type":"post","link":"https:\/\/mohan.sg\/?p=226","title":{"rendered":"Linux System Monitoring Commands"},"content":{"rendered":"<p><strong>Linux System Monitoring Commands<\/strong><\/p>\n<p>#1: top &#8211; Process Activity Command<\/p>\n<p>Commonly Used Hot Keys<\/p>\n<p>The top command provides several useful hot keys:<br \/>\nHot Key\tUsage<br \/>\nt\tDisplays summary information off and on.<br \/>\nm\tDisplays memory information off and on.<br \/>\nA\tSorts the display by top consumers of various system resources. Useful for quick identification of performance-hungry tasks on a system.<br \/>\nf\tEnters an interactive configuration screen for top. Helpful for setting up top for a specific task.<br \/>\no\tEnables you to interactively select the ordering within top.<br \/>\nr\tIssues renice command.<br \/>\nk\tIssues kill command.<br \/>\nz\tTurn on or off color\/mono<\/p>\n<p>What are the CPU states found in &#8220;top&#8221; output?<br \/>\nCpu(s): 0.0%us, 0.0%sy, 0.0%ni,100.0%id, 0.0%wa, 0.0%hi, 0.0%si, 0.0%st<\/p>\n<p># us -> User CPU time: The time the CPU has spent running users\u2019 processes that are not niced.<br \/>\n# sy -> System CPU time: The time the CPU has spent running the kernel and its processes.<br \/>\n# ni -> Nice CPU time: The time the CPU has spent running users\u2019 process that have been niced.<br \/>\n# wa -> iowait: Amount of time the CPU has been waiting for I\/O to complete.<br \/>\n# hi -> Hardware IRQ: The amount of time the CPU has been servicing hardware interrupts.<br \/>\n# si -> Software Interrupts.: The amount of time the CPU has been servicing software interrupts. <\/p>\n<p>#2: vmstat &#8211; System Activity, Hardware and System Information<\/p>\n<p>The command vmstat reports information about processes, memory, paging, block IO, traps, and cpu activity.<\/p>\n<p>vmstat 3<\/p>\n<p>Display Memory Utilization Slabinfo<\/p>\n<p># vmstat -m<\/p>\n<p>Tail, Vmstat and Date  in Loop, Output every 10 Sec<br \/>\n# vmstat 1 1;for ((;;));do date; vmstat 10 2 | tail -n1;done<\/p>\n<p>3: w &#8211; Find Out Who Is Logged on And What They Are Doing<\/p>\n<p>w command displays information about the users currently on the machine, and their processes.<br \/>\n# w username<br \/>\n# w vivek<\/p>\n<p>#4: uptime &#8211; Tell How Long The System Has Been Running<\/p>\n<p># uptime<\/p>\n<p>#5: ps &#8211; Displays The Processes<\/p>\n<p>Show Long Format Output<\/p>\n<p># ps -Al<\/p>\n<p>Print All Process On The Server<\/p>\n<p># ps ax<br \/>\n# ps axu<\/p>\n<p>Memmory commands   cpu commands <\/p>\n<p>Print Security Information<\/p>\n<p># ps -eo euser,ruser,suser,fuser,f,comm,label<\/p>\n<p>Set Output In a User-Defined Format<\/p>\n<p>ps axo stat,euid,ruid,tty,tpgid,sess,pgrp,ppid,pid,pcpu,comm<\/p>\n<p>ps -eopid,tt,user,fname,tmout,f,wchan<\/p>\n<p>Display sorted process taking most CPU in descending order<br \/>\n# ps -eo pcpu,pid,user,args | sort -k 1 -r | head -10<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Linux System Monitoring Commands<\/p>\n<p>#1: top &#8211; Process Activity Command<\/p>\n<p>Commonly Used Hot Keys<\/p>\n<p>The top command provides several useful hot keys: Hot Key Usage t Displays summary information off and on. m Displays memory information off and on. A Sorts the display by top consumers of various system resources. Useful for quick identification of [&#8230;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[17],"tags":[],"_links":{"self":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts\/226"}],"collection":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=226"}],"version-history":[{"count":1,"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts\/226\/revisions"}],"predecessor-version":[{"id":227,"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts\/226\/revisions\/227"}],"wp:attachment":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=226"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=226"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=226"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}