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
23 hours 59 min ago
3 days 12 hours ago
5 days 19 hours ago
1 week 15 hours ago
1 week 6 days ago
1 week 6 days ago
2 weeks 2 hours ago
2 weeks 11 hours ago
2 weeks 2 days ago
2 weeks 2 days ago