Getting memory usage from 'ps aux' output with awk

Posted by JustB on Stack Overflow See other posts from Stack Overflow or by JustB
Published on 2010-04-16T22:41:35Z Indexed on 2010/04/16 23:53 UTC
Read the original article Hit count: 302

Filed under:
|

Hello everybody, I have to solve an exercise using awk. Basically I need to retrieve from 'ps aux' command the total of memory usage for each user and format like this:

User    Total%Mem
user1      3.4%
user2      1.5%

and so on.

The problem I can't seem to solve is: how do I know how many users are logged in? And how can I make a different sum for each one of them?

Thank you :)

© Stack Overflow or respective owner

Related posts about awk

Related posts about ps