dotfiles/.bin/whatmem
2023-11-02 22:16:35 +01:00

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