↑ ↓ select, Enter open, Esc close

Sum up RAM usage per program

user@server
ps -eo rss=,comm= | awk '{a[$2]+=$1} END {for (p in a) printf "%8.1f MB  %s\n", a[p]/1024, p}' | sort -rn | head -15

Adds up the RSS value of all processes per program name and prints the result in MB. This shows at a glance whether, say, 40 php-fpm workers together use more memory than the database. Helpful for setting pm.max_children or cache sizes realistically.

Note: Shared memory is counted for every process, so the values are an upper bound.

Also searched as

  • how much ram do all php-fpm processes use together
  • total memory per service
  • total apache ram usage
  • which program uses the most memory overall

Related one-liners

All in Processes

Read first, then run.

The commands on myline.de act directly on servers, files and databases. A wrong path or placeholder can delete data irreversibly or make a server unreachable.

  • All commands are provided without warranty and are not tested on every system.
  • Understand what a command does before running it, and check every placeholder.
  • Make a backup first and, if possible, try it on a test system.
  • You run commands at your own risk. Liability for damages is excluded to the extent permitted by law.