Ubuntu 查看cpu个数及核心数
总核数 = 物理CPU个数 X 每颗物理CPU的核数
总逻辑CPU数 = 物理CPU个数 X 每颗物理CPU的核数 X 超线程数
查看CPU型号
cat /proc/cpuinfo | grep 'model name' |uniq
# model name : Intel(R) Core(TM) i9-7900X CPU @ 3.30GHz
grep "model name" /proc/cpuinfo |awk -F ':' '{print $NF}'
# 输出如下
Intel(R) Core(TM) i9-7900X CPU @ 3.30GHz
Intel(R) Core(TM) i9-7900X CPU @ 3.30GHz
Intel(R) Core(TM) i9-7900X CPU @ 3.30GHz
Intel(R) Core(TM) i9-7900X CPU @ 3.30GHz
Intel(R) Core(TM) i9-7900X CPU @ 3.30GHz
Intel(R) Core(TM) i9-7900X CPU @ 3.30GHz
Intel(R) Core(TM) i9-7900X CPU @ 3.30GHz
Intel(R) Core(TM) i9-7900X CPU @ 3.30GHz
Intel(R) Core(TM) i9-7900X CPU @ 3.30GHz
Intel(R) Core(TM) i9-7900X CPU @ 3.30GHz
Intel(R) Core(TM) i9-7900X CPU @ 3.30GHz
Intel(R) Core(TM) i9-7900X CPU @ 3.30GHz
Intel(R) Core(TM) i9-7900X CPU @ 3.30GHz
Intel(R) Core(TM) i9-7900X CPU @ 3.30GHz
Intel(R) Core(TM) i9-7900X CPU @ 3.30GHz
Intel(R) Core(TM) i9-7900X CPU @ 3.30GHz
Intel(R) Core(TM) i9-7900X CPU @ 3.30GHz
Intel(R) Core(TM) i9-7900X CPU @ 3.30GHz
Intel(R) Core(TM) i9-7900X CPU @ 3.30GHz
Intel(R) Core(TM) i9-7900X CPU @ 3.30GHz
查看物理CPU个数
cat /proc/cpuinfo| grep "physical id"| sort| uniq| wc -l
查看每个物理CPU中core的个数(即核数)
cat /proc/cpuinfo| grep "cpu cores"| uniq
查看逻辑CPU的个数
cat /proc/cpuinfo| grep "processor"| wc -l
查看线程数
grep 'processor' /proc/cpuinfo | sort -u | wc -l
注意,此处查看的线程数是总的线程数,可以理解为逻辑cpu的数量