{"id":3444,"date":"2014-08-09T12:20:51","date_gmt":"2014-08-09T04:20:51","guid":{"rendered":"http:\/\/rmohan.com\/?p=3444"},"modified":"2014-08-09T12:20:51","modified_gmt":"2014-08-09T04:20:51","slug":"linux-memory","status":"publish","type":"post","link":"https:\/\/mohan.sg\/?p=3444","title":{"rendered":"LINUX MEMORY"},"content":{"rendered":"<p>Find Memory Usage<\/p>\n<p>System memory used and free<\/p>\n<p>Total Used and Free Memory in MBytes (in that order)<\/p>\n<p>free -m|grep &#8220;buffers\/cache&#8221;|cut -d&#8221;:&#8221; -f2<br \/>\nMemory by Process<\/p>\n<p>Raw<\/p>\n<p>ps -e -orss=,args= | sort -b -k1,1n | pr -TW$COLUMNS<br \/>\nHuman readable<\/p>\n<p>ps -e -orss=,args= | sort -b -k1,1n | awk &#8216;{ split( &#8220;KB MB GB&#8221; , v ); s=1; while( $1>1024 ){ $1\/=1024; s++ } print int($1) &#8221; &#8221; v[s] &#8221; &#8221; $2 }&#8217;<br \/>\nMemory by Process &#8211; Grouped together<\/p>\n<p>Raw<\/p>\n<p>ps -e -orss=,args= | awk &#8216;{arr[$2]+=$1} END {for (i in arr) {print arr[i],i}}&#8217; | sort -b -k1,1n<br \/>\nHuman readable<\/p>\n<p>ps -e -orss=,args= | awk &#8216;{arr[$2]+=$1} END {for (i in arr) {print arr[i],i}}&#8217; | sort -b -k1,1n | awk &#8216;{ split( &#8220;KB MB GB&#8221; , v ); s=1; while( $1>1024 ){ $1\/=1024; s++ } print int($1) &#8221; &#8221; v[s] &#8221; &#8221; $2 }&#8217;<br \/>\nTotal RSS Memory<\/p>\n<p>ps -e -orss= | awk &#8216;{ sum += $1 } END { print sum }&#8217;<br \/>\nHuman redable<\/p>\n<p>ps -e -orss= | awk &#8216;{ sum += $1 } END { print sum }&#8217; | awk &#8216;{ split( &#8220;KB MB GB&#8221; , v ); s=1; while( $1>1024 ){ $1\/=1024; s++ } print int($1) &#8221; &#8221; v[s] &#8221; &#8221; $2 }&#8217;<br \/>\nTotal Memory<\/p>\n<p>smem -w -t -k<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Find Memory Usage<\/p>\n<p>System memory used and free<\/p>\n<p>Total Used and Free Memory in MBytes (in that order)<\/p>\n<p>free -m|grep &#8220;buffers\/cache&#8221;|cut -d&#8221;:&#8221; -f2 Memory by Process<\/p>\n<p>Raw<\/p>\n<p>ps -e -orss=,args= | sort -b -k1,1n | pr -TW$COLUMNS Human readable<\/p>\n<p>ps -e -orss=,args= | sort -b -k1,1n | awk &#8216;{ split( &#8220;KB MB GB&#8221; , v [&#8230;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4,17,47],"tags":[],"_links":{"self":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts\/3444"}],"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=3444"}],"version-history":[{"count":1,"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts\/3444\/revisions"}],"predecessor-version":[{"id":3445,"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts\/3444\/revisions\/3445"}],"wp:attachment":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=3444"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=3444"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=3444"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}