Sign up ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. It's 100% free, no registration required.

Possible Duplicate:
Measuring RAM usage of a program

I am trying to use ps to benchmark a program, I'm just not sure which flags to use. I would like to get the amount of RAM the program used in total, what flag should I use?

share|improve this question

marked as duplicate by Gilles, jasonwryan, warl0ck, Renan, Michael Mrozek Sep 16 '12 at 17:24

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

I assume you mean the total memory usage? That's already been answered: Measuring RAM usage of a program If you mean the current usage at the point when you run ps, see Mathematical connection between SZ RSS and VSZ in ps o/p? – Gilles Sep 10 '12 at 0:00
I actually want to know the total RAM usage of just one of my processes... Im not that familiar with linux so Im not sure what I need, I tried the one answer ps axu|grep YOUR_PROCESS | grep -v grep|awk {'print $4'} and it printed 0.7... Im not sure 0.7 what exactly – Peppercat101 Sep 10 '12 at 8:23

2 Answers 2

For applications that run with more than one instance, you would need to sum the total. You could use awk to do this:

ps aux | awk '/YOUR_APP/ { sum+=$4 } END { print sum }'
share|improve this answer
It couldnt find awk, I installed gawk but now it says cannot open file '{' – Peppercat101 Sep 10 '12 at 8:28
ps axu|grep YOUR_PROCESS | grep -v  grep|awk {'print $4'}
share|improve this answer
This prints 0.7... What does the 0.7 mean? – Peppercat101 Sep 10 '12 at 8:24
tty which place of running process, if ? it means a kernel module , and if ttyN , such as tty3 ran in tty3, and ran in pts3 , ran in virtual tty, /dev/pts/N such as /dev/pts/3 are virtual tty sush as gnome-terminal. next field is STAT S,s,Zs+, for more info refer to man of field is Start that mentioned to start time of field is TIME that mentioned to time of running program.last field is command , if enclosed in bracket it's a kernel module.Unfortunately i don't know about RSS and VSZ fields. – PersianGulf Sep 11 '12 at 0:47

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