how to sort mem process using ps command
Roberto Ragusa
mail at robertoragusa.it
Fri Jul 14 08:25:07 UTC 2006
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
More information about the users
mailing list