Take the 2-minute tour ×
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.

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

1 Answer 1

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

 
discard

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.