1.查看Linux服务器物理CPU个数:
cat /proc/cpuinfo| grep "physical id"| sort| uniq| wc -l
2.查看Linux服务器每个物理CPU逻辑CPU个数(多少核):
cat /proc/cpuinfo| grep "cpu cores"| uniq
3.查看Linux服务总共逻辑核数:
cat /proc/cpuinfo| grep "processor"|wc -l
4.如果开起超线程:
则cat /proc/cpuinfo| grep "processor"|wc -l 的值=cat /proc/cpuinfo| grep "physical id"| sort| uniq| wc -l * cat /proc/cpuinfo| grep "cpu cores"| uniq *2
否则:
cat /proc/cpuinfo| grep "processor"|wc -l 的值=cat /proc/cpuinfo| grep "physical id"| sort| uniq| wc -l * cat /proc/cpuinfo| grep "cpu cores"| uniq