Created
December 23, 2021 20:45
-
-
Save mattsta/e63b7be8ccbb002ad09aa1465095a01b to your computer and use it in GitHub Desktop.
Revisions
-
mattsta created this gist
Dec 23, 2021 .There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,9 @@ #!/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]'