Memory usage grouped by parent process

If you want something interactive, try :

atop - launch it and press 'm' (memory usage) and 'p' (group by process name).

If you want something scriptable, there's something a bit like the below - although it's not doing quite what you've asked for (PPID 1), but you can group based on e.g. process name using awk -

ps -eo pmem,vsize,cmd | grep -v '\[' | awk 'NR>2{mem[$3]+=$2}END {for(k in mem) print k " " mem[k]/1024000};' | sort -gk 2 | tail -n 10

There's probably some clever way to filter on ppid with the ps... but I'm too stupid to figure it out quickly.


On a distro using systemd, systemd-cgls should show memory usage per service. Doesn't always obtain the information though.