1
0
Fork 0
mirror of https://github.com/notwa/rc synced 2024-07-01 03:07:13 -07:00
rc/sh/psbm

15 lines
344 B
Plaintext
Raw Normal View History

#!/usr/bin/env sh
2021-07-29 00:37:35 -07:00
# YES_ZSH
# YES_BASH
# YES_DASH
2021-07-29 00:37:35 -07:00
psbm() { ### @-
[ -z "$MSYSTEM" ] || { printf "%s\n" "$0: unsupported on MSYS2" >&2; return 1; }
2021-07-29 00:37:35 -07:00
ps axco rss,pid,command | awk '
NR>1&&$1>0{t+=$1;printf("%8.2fM %7d %s\n",$1/1024,$2,$3)}
END{printf("%8.2fM\n",t/1024)}
' | sort -n
}
[ "${SOURCING:-0}" -gt 0 ] || psbm "$@"