cat /proc/cpuinfo
lscpu
**查看物理CPU个数**:
cat /proc/cpuinfo | grep "physical id" | sort | uniq | wc -l
**查看每个物理CPU的核数**:
cat /proc/cpuinfo | grep "cpu cores" | uniq
**查看逻辑CPU个数**:
cat /proc/cpuinfo | grep "processor" | wc -l
**检测是否启用超线程**:
cat /proc/cpuinfo | grep -e "cpu cores" -e "siblings" | sort | uniq
lscpu详解:
Architecture: x86_64
CPU op-mode(s): 32-bit, 64-bit
Byte Order: Little Endian
CPU(s): 8
On-line CPU(s) list: 0-7
Thread(s) per core: 2
Core(s) per socket: 4
Socket(s): 1
NUMA node(s): 1
Vendor ID: GenuineIntel
CPU family: 6
Model: 142
Model name: Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz
Stepping: 9
CPU MHz: 800.000
CPU max MHz: 4500.0000
CPU min MHz: 400.0000
BogoMIPS: 8388.60
Virtualization: VT-x
L1d cache: 32K
L1i cache: 32K
L2 cache: 256K
L3 cache: 8192K
NUMA node0 CPU(s): 0-7