Quote:
Originally Posted by LinBox2013
Install smem and do a smem -u.
Or this: (echo "user rss(KiB) vmem(KiB)";
for user in $(users | tr ' ' '\n' | sort -u); do
echo $user $(ps -U $user --no-headers -o rss,vsz \
| awk '{rss+=$1; vmem+=$2} END{print rss" "vmem}')
done | sort -k3
) | column -t
|
This script is using an empty variable (users) which will need to be populated before the script is run for it to work:
users=`ps -eouser --sort user --noheader|uniq`
Or subsititue the command string in place of the $users entry.
An alternative string using less commands with less elegant output could be:
ps -eouser,size --sort user --no-header|awk '!($1 in a){a[$1];print rec,sum;sum=""}{sum+=$2;rec=$1} END {print rec,sum}'
The values are in KB. and represent the currently allocated and intented to be allocated memory not the virtual memory.
However This is still not ideal as it will only provide a rough value.
Cheers