Re: how to sort mem process using ps command

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Kaushal Shriyan wrote:

> I didnot hear from you on my query for
> 
>> using this command "ps ww -e --sort -rss o
>> pid,pmem,command,rss,size,vsz|head -20"
>> I want to check which user is hogging more memory

I don't know if

  ps ww -e --sort -rss o user,pid,pmem,command,rss,size,vsz|head -20

is enough for you.
It will show the processes hogging more memory and the user they
belong to.

Maybe you want something different: the sum of all the processes
belonging to one user. In that case I think a little script is needed.
Here is my ugly attempt:

  ps ww -e --sort -rss o user=,rss=,pid=,pmem=,command=,size=,vsz=\
  |(sort; echo)\
  |gawk '{if ( lastuser == $1 ) {tot=tot+$2} \
   else {printf "%9i %s\n",tot,lastuser; tot=$2}; lastuser=$1 }'|\
  sort -nr

Best regards.
-- 
   Roberto Ragusa    mail at robertoragusa.it


[Index of Archives]     [Current Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]     [Fedora Docs]

  Powered by Linux