天天看點

Linux檢視CPU個數

一 檢視cpu型号

root@localhost:~# grep name  /proc/cpuinfo | sort | uniq
model name      : Intel Core Processor (Broadwell, no TSX)      

二 檢視實體CPU個數

root@localhost:~# grep "physical id" /proc/cpuinfo | sort | uniq | wc -l
1      

三 檢視CPU核數

root@localhost:~# grep "core id" /proc/cpuinfo | sort | uniq | wc -l
2      

四 檢視CPU線程數

root@localhost:~# grep "processor" /proc/cpuinfo | sort | uniq | wc -l
4      

五 lscpu指令

root@locaohost:~# lscpu
Architecture:                    x86_64  #架構 
CPU op-mode(s):                  32-bit, 64-bit  
Byte Order:                      Little Endian
Address sizes:                   46 bits physical, 48 bits virtual
CPU(s):                          4  #邏輯cpu顆數
On-line CPU(s) list:             0-3 #線上的cpu數量
Thread(s) per core:              2 #每個核心線程
Core(s) per socket:              2 #每個cpu插槽核數/每顆實體cpu核數
Socket(s):                       1 #cpu插槽數 
NUMA node(s):                    1
Vendor ID:                       GenuineIntel #cpu廠商ID 
CPU family:                      6
Model:                           61 #型号
Model name:                      Intel Core Processor (Broadwell, no TSX)
Stepping:                        2 #步進 
CPU MHz:                         2194.916 #cpu主頻 
BogoMIPS:                        4389.83
Hypervisor vendor:               KVM
Virtualization type:             full #cpu支援的虛拟化技術
L1d cache:                       64 KiB #cpu的L1資料緩存
L1i cache:                       64 KiB #cpu的L1指令緩存
L2 cache:                        8 MiB #二級緩存
L3 cache:                        16 MiB #三級緩存
NUMA node0 CPU(s):               0-3