I need a way to see how many bytes to top ten processes are using not percentage. I am using centos

link|improve this question

50% accept rate
Your question is vague and ambiguous. Are you asking about physical memory? – David Schwartz Aug 27 '11 at 15:29
yes, I want to know how many bytes the top programs are using so I can monitor it over time and figure out why the resources are growing and on what. – David Aug 27 '11 at 16:12
feedback

3 Answers

up vote 2 down vote accepted

it would be better to use ps with head

ps aux --sort -rss | head -10

The RSS field shows physical memory usage in KB.

link|improve this answer
This displays memory percentage. I would really like to see how many bytes in KB or MB. – David Aug 27 '11 at 4:32
no look on the rss column – Mike Aug 27 '11 at 4:33
is -rss bytes? KB? MB? – David Aug 27 '11 at 4:53
it is in KB that is your resident memory – Mike Aug 27 '11 at 16:29
This seems like your answer. The 'RSS' field has your answer in KB. – David Schwartz Aug 27 '11 at 16:32
show 1 more comment
feedback

I just notice that rss is in kiloBytes.

I created an awk script to print sizes in human readable format:

#!/usr/bin/awk

{
    hr[1024**2]="GB"; hr[1024]="MB";
    for (x=1024**3; x>=1024; x/=1024) {
        if ($1>=x) {
            printf ("%-6.1f %s ", $1/x, hr[x]); break
        }
    }
}
{ printf ("%-6s %-10s ", $2, $3) }
{ for ( x=4 ; x<=NF ; x++ ) { printf ("%s ",$x) } print ("") }

and pipe the ps output to:

$ ps --no-headers -eo rss,pid,user,command --sort -rss | head -10 | awk -f topmem.awk
link|improve this answer
feedback

top and hit M sorts by resident memory usage. Quickest and easiest I know of.

link|improve this answer
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.