From a5db770144b79e05d7bbe5b0483de8e422473e9e Mon Sep 17 00:00:00 2001 From: c0dev0id Date: Thu, 2 Nov 2023 22:16:35 +0100 Subject: [PATCH] Update 2023-11-02 22:16 OpenBSD/amd64-x13 --- .bin/whatmem | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100755 .bin/whatmem diff --git a/.bin/whatmem b/.bin/whatmem new file mode 100755 index 0000000..4079132 --- /dev/null +++ b/.bin/whatmem @@ -0,0 +1,15 @@ +#!/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