The
top
command has lots of useful columns, but since many applications run multiple worker processes (eg. webservers like Apache), it's a bit difficult to see the big picture. The following one-liner aggregates a selected column in the output of
top
by the process name (ie. the COMMAND column) and sorts the result in decreasing order:
top -b -n 1 | tail -n +8 | awk '{ col=$6; if (match(col, "^[0-9]+m$")) { col = 1000 * substr(col, 1, length(col) - 1) }; stat[$12] += col } END { for (i in stat) { print stat[i] ": " i } }' | sort -rn | head -n 20
Recent comments
2 years 23 weeks ago
3 years 45 weeks ago
3 years 45 weeks ago
3 years 47 weeks ago
3 years 48 weeks ago
4 years 3 weeks ago
4 years 3 weeks ago
4 years 3 weeks ago
4 years 3 weeks ago
4 years 3 weeks ago