Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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

share|improve this question
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
up vote 6 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.

share|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

I just notice that rss is in kiloBytes.

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


    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

share|improve this answer

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

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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