Skip to content

Instantly share code, notes, and snippets.

@mccun934
Created March 25, 2019 16:26
Show Gist options
  • Save mccun934/9a2daf9804eef34966e2a11b97dffe6b to your computer and use it in GitHub Desktop.
Save mccun934/9a2daf9804eef34966e2a11b97dffe6b to your computer and use it in GitHub Desktop.
sum up the ram used by all processes with a given name.
#!!bin/bash
# requires 'bc' installed
# Sum up the RAM used by processes with given name
# eg:
# $ mem-process-sum postgres
# 1.6777 GB
ps aux | sort -nk6 |grep $1 | awk '{print $6}' | paste -sd+ | bc | awk '{$1=$1/(1024^2); print $1,"GB";}'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment