How do I see the memory footprint of each user?

Here is a quick ksh script to add up all the memory of processes for each user: –

date
for user in `ps aux|grep -v USER|awk '{print $1}'|sort|uniq`
do
ps aux | grep $user | awk '{print $6}'|awk '{x+=$1} END{printf "%-10s : '$user'\n",x}'
done|sort -nk1

Outputs something like :

Fri 25 Feb 14:01:33 2011
4044       : at02fubr
7144       : at01fubr
79608      : at02brkr
93056      : at01brkr
114328     : root
286044     : mqm
1348248    : mqsvcs02
1435336    : mqsvcs01

About

I'm a freelance UNIX engineer working in the UK. I'm married to Tina and between us we have six children. I'm a bit of an Apple fan boy, and all the Windows machines in the house are a thing of the past now.

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: