Welcome!
Wednesday 08 September 2010 @ 15:16 CEST

Memory usage by user

TechA short little script I stumbled across when cleaning my $HOME. I do not think I wrote it myself - at least I can't recall that I did. Quite handy and it's small and compact using the commands ps, awk, sort and head:

ps aux --no-headers | awk '
{
name[$1] += $1;
pros[$1] += $4;
mem[$1] += $5
}
END {
for (var in name) {
print mem[var]" "var" "pros[var]
}
}' | sort -nr | head

The result is a top ten list of the users that consume the most memory:

741012 root 9.3
238152 bjorn 3.8
119380 thomasez 1.2
105332 krav 1.9
100804 lars 0.6
95916 ingvar 1.6
89720 kjetilho 1.5
78044 jo 1
74232 espen 0.8
73460 michael 0.4

There I am - at number five...

What's Related

Trackback

Trackback URL for this entry: http://blog.larsstrand.org/trackback.php?id=Memory-usage-by-user

No trackback comments for this entry.
Memory usage by user | 1 comments | Create New Account
The following comments are owned by whomever posted them. This site is not responsible for what they say.
Cleaning my home
Authored by: keithedinburgh on Saturday 24 July 2010 @ 20:05 CEST
Found your blog by mistake when looking for something else - cleaning my home!

If you need help with cleaning your home and you are in Scotland I may be able to help with driveway, patio, decking and tarmac cleaning -

Also to ask if anyone has any experience with Prezi - it looks great but it is beyond my capabilities to work it, if there is a student out there who can help for some spare cash then get in touch please.

Thanks Keith.