dotfiles/.bin/whatmem

16 lines
309 B
Bash
Executable File

#!/bin/sh
for i in $@
do
RES="$(ps -x -o "comm rsz" | grep -Ei "$i")"
if [ ! -z "$RES" ]
then
echo "$RES" | xargs -n2 -I{} echo "Adding: {} KB"
echo "$RES" | awk '{ sum=sum+$2; } END { printf("Summary: %.2f MB\n", sum/1024); }'
else
echo "$@ not found."
fi
done