Created
March 25, 2019 16:26
-
-
Save mccun934/9a2daf9804eef34966e2a11b97dffe6b to your computer and use it in GitHub Desktop.
sum up the ram used by all processes with a given name.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!!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