Created
December 23, 2021 20:45
-
-
Save mattsta/e63b7be8ccbb002ad09aa1465095a01b to your computer and use it in GitHub Desktop.
This file contains hidden or 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 | |
# mac vm_stat output is unreadable by default (it reports values as multiple of 16384 byte pages), | |
# so convert the results to actual GB used automatically. | |
# this python one liner is a list comprehension because it has to hack around | |
# python not allowing single-line for loops directly. | |
vm_stat | python -c 'import sys; [print(f"{l:<35}{int(sz) * 16384 / 2**30:>15,.2f} GB") for idx, (l, sz) in enumerate(x.strip().strip(".").split(":") for x in sys.stdin) if idx > 0]' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
before as native
vm_stat
:after as
vmstat.sh
: