David Asked: 2011-08-27 20:18:22 +0800 CST2011-08-27 20:18:22 +0800 CST 2011-08-27 20:18:22 +0800 CST Memory Usage by Bytes Top 10 772 I need a way to see how many bytes to top ten processes are using not percentage. I am using centos memory top 3 Answers Voted Best Answer Mike 2011-08-27T20:22:08+08:002011-08-27T20:22:08+08:00 it would be better to use ps with head ps aux --sort -rss | head -10 The RSS field shows physical memory usage in KB. quanta 2011-08-27T21:40:59+08:002011-08-27T21:40:59+08:00 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 womble 2011-08-27T20:26:58+08:002011-08-27T20:26:58+08:00 top and hit M sorts by resident memory usage. Quickest and easiest I know of.
it would be better to use ps with head
The
RSS
field shows physical memory usage in KB.I just notice that
rss
is in kiloBytes.I created an
awk
script to print sizes in human readable format:and pipe the
ps
output to:$ ps --no-headers -eo rss,pid,user,command --sort -rss | head -10 | awk -f topmem.awk
top
and hitM
sorts by resident memory usage. Quickest and easiest I know of.