algorithm

   PID USERNAME  SIZE   RSS STATE  PRI NICE      TIME  CPU PROCESS/NLWP
 21444 tomusr    213M   61M sleep   29   10   1:20:46 0.1% java/43
 21249 root       93M   44M sleep   29   10   1:07:19 0.2% java/56

is there anyway i can use a command to get the total of the SIZE? 306M (Derive from 213M + 93M from SIZE)

awk '{s+=$3}END{print s}' file

however, if you have other units besides M, you have do some conversion first.

I would like to add a small modification

awk '!/SIZE/ {s+=$3}END{print s}' file

I think awk (GNU) knows how to take care of that

# more file
 PID USERNAME  SIZE   RSS STATE  PRI NICE      TIME  CPU PROCESS/NLWP
 21444 tomusr    213M   61M sleep   29   10   1:20:46 0.1% java/43
 21249 root       93M   44M sleep   29   10   1:07:19 0.2% java/56
# awk '{s+=$3}END{print s}' file
306

can you verify on your end? thanks

as for my side i am using it on a prstat command ..

what i've done is

prstat -s size | awk '{s+=$3}END{print s}'

:slight_smile:

I thought that the 'SIZE' meant the total size of the process, while RSS meant the portion that was actually in the system memory.