Last active
May 8, 2023 15:30
-
-
Save mikemcbride/e58ed4fc863d08098febb32fc3cd3ef7 to your computer and use it in GitHub Desktop.
Bash implementation of the vmrss linux util
This file contains 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
#!/usr/bin/env bash | |
if [[ "${1}" == "" ]]; then | |
echo "must provide a process" | |
exit 1 | |
fi | |
while : | |
do | |
ps -o rss "${1}" | tail -1 | numfmt --to=si | |
sleep 1 | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
vmrss
is a useful utility that doesn't exist on macOS, but you can pretty easily recreate it using bash. This prints out the memory used by the provided process once every second, and prints it out in a friendly format. To see raw bytes, you can remove the| numfmt --to=si
part.