Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

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'd like to know how much resource a specific command is using.

top and htop displays information on per process basis but I'd like the information to be shown on per command basis. E.g. I'd like to know how much RAM chrome is using.

share|improve this question
Utilities such as top and ps vary by OS. You should tag the question with the OS you are using. – jordanm Nov 7 '12 at 22:17
@jordanm thanks, I'm using Linux – brillout.com Nov 8 '12 at 0:26

You could run top in batch mode -b with 1 iteration -n1. You grep it, pipe it to awk, SUM the result and print it.

top -b -n1 | grep chrome | awk '{ SUM += $9} END { print SUM }'

I don't know which column you want to output. Change $9 to fit your needs.

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.