Last active
May 7, 2019 02:31
-
-
Save o0-o/e87a0564c95d9fce11f70c81c73c1bf3 to your computer and use it in GitHub Desktop.
[Memory] Prints amount of memory in bytes #Shell
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
# mem.sh | |
( # linux | |
grep "MemTotal" /proc/meminfo | | |
awk '{ printf "%d\n", $2 * 1000 }' || | |
# bsd | |
sysctl -n hw.realmem 2>/dev/null || | |
# macos | |
# TODO: this number is returning ~68GB on a system with 64GB installed | |
sysctl -n hw.memsize 2>/dev/null || | |
) 2>/dev/null || | |
exit 1 #failure | |
exit 0 #success |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment