Tagged: ,

  • This topic is empty.
Viewing 0 reply threads
  • Author
    • #1894
      Amit Bansal

      At times, you wish to find the processes with maximum memory consumption. This can be easily done using following command. Copy contents in file and run it like as vmstat command

      <br />
      ### Usage mem_mon.sh (interval) (occurences) e.g sh mem_mon.sh 2 10 ###<br />
      ### This will give top 10 memory consuming processes #####<br />
      wt_time=$1<br />
      lmt=$2<br />
      let a=0<br />
      while <a href="/?page=a_lt_lmt" class="bbcode_wiki">$a -lt $lmt</a> ; do<br />
      ps axwv |sort -nrk 7,7|grep -v "COMMAND" <br />
      |awk 'BEGIN {printf ("MemoryinKb t ProcessId t PerCPU t PerMem t Command n")}{t=t+$7 - $10 ;printf("%13d t %10d t %6.2f t %6.2f t %s n",$7 - $10,$1,$11,$12,$13)}END{print t}'|head -10<br />
      let      a+=1<br />
      sleep $wt_time<br />
      done<br />

Viewing 0 reply threads
  • You must be logged in to reply to this topic.