Linux常用命令-lscpu

命令

lscpu

描述

display information about the CPU architecture
显示CPU架构信息

用法

1
lscpu [options]

选项

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
Options:
-a, --all 显示所有CPU,需配合-e或-p使用
-b, --online 显示在线的CPU,需配合-e或-p使用
-c, --offline 显示离线的CPU,需配合-e或-p使用
-e, --extended[=<list>] 显示扩展格式,如-e=cpu,node
-p, --parse[=<list>] 显示CSV格式,以逗号分隔
-x, --hex 显示十六进制掩码

Architecture: 架构
CPU(s): 逻辑CPU数量,即Socket*Core*Thread
Thread(s) per core: 每个核心的线程数
Core(s) per socket: 每个CPU插槽核心数/每颗物理CPU核心数
Socket(s): CPU插槽数
Vendor ID: CPU厂商ID
CPU family: CPU系列
Model: 型号
Stepping: 步进
CPU MHz: CPU主频
Hypervisor vendor: 虚拟化平台
Virtualization: CPU支持的虚拟化技术

注意

示例

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
$ lscpu
Architecture: x86_64
CPU op-mode(s): 32-bit, 64-bit
Byte Order: Little Endian
CPU(s): 2
On-line CPU(s) list: 0,1
Thread(s) per core: 1
Core(s) per socket: 1
Socket(s): 2
NUMA node(s): 1
Vendor ID: GenuineIntel
CPU family: 6
Model: 142
Model name: Intel(R) Core(TM) i5-8265U CPU @ 1.60GHz
Stepping: 11
CPU MHz: 1800.002
BogoMIPS: 3600.00
Hypervisor vendor: VMware
Virtualization type: full
L1d cache: 32K
L1i cache: 32K
L2 cache: 256K
L3 cache: 6144K
NUMA node0 CPU(s): 0,1
Flags: fpu vme de mmx fxsr sse sse2 ss ssse3...

$ lscpu
...
Model name: Intel(R) Xeon(R) CPU E5-26xx v4
Stepping: 1
CPU MHz: 2399.998
BogoMIPS: 4799.99
Hypervisor vendor: KVM
Virtualization type: full
...

$ lscpu -ae
CPU NODE SOCKET CORE L1d:L1i:L2:L3 ONLINE
0 0 0 0 0:0:0:0 yes
1 0 1 1 1:1:1:1 yes
$ lscpu -ap
# CPU,Core,Socket,Node,,L1d,L1i,L2,L3
0,0,0,0,,0,0,0,0
1,1,1,0,,1,1,1,1
# 指定显示格式
$ lscpu -e=cpu,core,online
CPU CORE ONLINE
0 0 yes
1 1 yes