Last active
May 7, 2019 01:13
-
-
Save o0-o/13fdd4ece3d34bd41d35ae22ee233eba to your computer and use it in GitHub Desktop.
[CPU Model] Print the make of the CPU #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
# cpu_model.sh | |
( # linux (proc) | |
grep "model name" /proc/cpuinfo | | |
uniq | | |
sed 's/[[:space:]]\{1,\}/ /g' | | |
sed 's/^model name : //' || | |
# linux (lscpu) | |
lscpu | | |
grep "Model name:" | | |
sed 's/[[:space:]]\{1,\}/ /g' | | |
sed 's/^Model name: //' || | |
# macos | |
sysctl -n machdep.cpu.brand_string || | |
# bsd | |
sysctl -n hw.model | | |
sed 's/[[:space:]]\{1,\}/ /g' || | |
# linux/bsd (dmidecode) | |
dmidecode --type processor | | |
grep "Version: " | | |
uniq | | |
sed 's/[[:space:]]\{1,\}/ /g' | | |
sed 's/^ Version: //' | |
) 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