Skip to content

Instantly share code, notes, and snippets.

@mikemcbride
Last active May 8, 2023 15:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mikemcbride/e58ed4fc863d08098febb32fc3cd3ef7 to your computer and use it in GitHub Desktop.
Save mikemcbride/e58ed4fc863d08098febb32fc3cd3ef7 to your computer and use it in GitHub Desktop.
Bash implementation of the vmrss linux util
#!/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
@mikemcbride
Copy link
Author

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment