查看 Linux Cpu 信息
查看CPU信息(型号)
cat /proc/cpuinfo | grep name | cut -f2 -d: | uniq -c
48 Intel(R) Xeon(R) Silver 4214R CPU @ 2.40GHz
查看Linux 内核
uname -a
Linux hadoop195 3.10.0-957.el7.x86_64 #1 SMP Thu Nov 8 23:39:32 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux
查看物理CPU个数
cat /proc/cpuinfo| grep "physical id"| sort| uniq| wc -l
2
查看每个物理CPU中core的个数(即核数)
cat /proc/cpuinfo| grep "cpu cores"| uniq
cpu cores : 12
查看逻辑CPU的个数
cat /proc/cpuinfo| grep "processor"| wc -l
48
info
这个服务器一共有48个逻辑CPU,也就是我们常说的线程数,也就说每个核可以提供两个线程。
tip
总核数 = 物理CPU个数 X 每颗物理CPU的核数
总逻辑CPU数 = 物理CPU个数 X 每颗物理CPU的核数 X 超线程数
查看内存情况
free -m
total used free shared buff/cache available
Mem: 257037 26200 155314 105 75522 229448
Swap: 4095 43 4052
free -g
total used free shared buff/cache available
Mem: 251 25 151 0 73 224
Swap: 3 0 3
tip
-m 会以兆为单位来显示服务器的内存,-g 会以 G 为单位来显示服务器的内存