linux查询CPU信息几种方式
linux-dash
A beautiful web dashboard for Linux
项目地址:https://gitcode.com/gh_mirrors/li/linux-dash
免费下载资源
·
CPU架构
CPU架构主要包括:amd64、arm32v7、arm64v8、mips64el、mips32、ppc64le和ppc32等架构。
CPU信息
CPU信息主要为中央处理器详细信息,包括:
- 架构
- 核心数量
- 处理速度
- 厂商名称
- CPU主频
- 标签
- .......
注:不同的操作系统或者CPU架构提供的信息不一定相同。
查询CPU信息方式
1. /proc/cpuinfo
/proc/cpuinfo文件包含关于cpu详细信息,用cat或less命令输出它的内容。
root@super:/# cat /proc/cpuinfo
processor : 0
vendor_id : GenuineIntel
cpu family : 6
model : 60
model name : Intel(R) Core(TM) i7-4710MQ CPU @ 2.50GHz
stepping : 3
microcode : 0x25
cpu MHz : 2494.235
cache size : 6144 KB
physical id : 0
siblings : 2
core id : 0
cpu cores : 2
apicid : 0
initial apicid : 0
fpu : yes
fpu_exception : yes
cpuid level : 13
wp : yes
flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ss ht syscall nx pdpe1gb rdtscp lm constant_tsc arch_perfmon nopl xtopology tsc_reliable nonstop_tsc cpuid pni pclmulqdq ssse3 fma cx16 pcid sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand hypervisor lahf_lm abm cpuid_fault invpcid_single pti ssbd ibrs ibpb stibp fsgsbase tsc_adjust bmi1 avx2 smep bmi2 invpcid xsaveopt arat flush_l1d arch_capabilities
bugs : cpu_meltdown spectre_v1 spectre_v2 spec_store_bypass l1tf mds swapgs itlb_multihit
bogomips : 4988.47
clflush size : 64
cache_alignment : 64
address sizes : 43 bits physical, 48 bits virtual
power management:
可以通过grep命令过滤信息,如
cat /proc/cpuinfo | grep processor | wc -l
cat /proc/cpuinfo | grep 'core id'
2. lscpu
lscpu是一个小而快速的命令,不需要任何选项。它能够简单地以用户友好的格式打印cpu详细信息。
root@super:/# lscpu
Architecture: x86_64
CPU op-mode(s): 32-bit, 64-bit
Byte Order: Little Endian
Address sizes: 43 bits physical, 48 bits virtual
CPU(s): 2
On-line CPU(s) list: 0,1
Thread(s) per core: 1
Core(s) per socket: 2
Socket(s): 1
NUMA node(s): 1
Vendor ID: GenuineIntel
CPU family: 6
Model: 60
Model name: Intel(R) Core(TM) i7-4710MQ CPU @ 2.50GHz
Stepping: 3
CPU MHz: 2494.235
BogoMIPS: 4988.47
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 pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ss ht syscall nx pdpe1gb rdtscp lm constant_tsc arch_perfmon nopl xtopology tsc_reliable nonstop_tsc cpuid pni pclmulqdq ssse3 fma cx16 pcid sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand hypervisor lahf_lm abm cpuid_fault invpcid_single pti ssbd ibrs ibpb stibp fsgsbase tsc_adjust bmi1 avx2 smep bmi2 invpcid xsaveopt arat flush_l1d arch_capabilities
3. lshw
lshw命令可以显示关于cpu的有限信息。默认情况下,lshw显示关于各种硬件部件的信息,而“-class”选项可用于提取关于特定硬件部件的信息。
没有该命令,执行
apt install -y lshw
root@super:/# lshw -class processor
*-cpu:0
description: CPU
product: Intel(R) Core(TM) i7-4710MQ CPU @ 2.50GHz
vendor: Intel Corp.
physical id: 1
bus info: cpu@0
version: Intel(R) Core(TM) i7-4710MQ CPU @ 2.50GHz
slot: CPU #000
size: 2500MHz
capacity: 4230MHz
width: 64 bits
capabilities: lm fpu fpu_exception wp vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ss ht syscall nx pdpe1gb rdtscp x86-64 constant_tsc arch_perfmon nopl xtopology tsc_reliable nonstop_tsc cpuid pni pclmulqdq ssse3 fma cx16 pcid sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand hypervisor lahf_lm abm cpuid_fault invpcid_single pti ssbd ibrs ibpb stibp fsgsbase tsc_adjust bmi1 avx2 smep bmi2 invpcid xsaveopt arat flush_l1d arch_capabilities
configuration: cores=2 enabledcores=2
4. hardinfo
Hardinfo是一个基于gtk的gui工具,它可以生成关于各种硬件组件的报告。但是,只有在没有gui显示可用的情况下,它才能从命令行运行。一般Linux,没有此命令不推荐使用。
5. nproc
nproc命令只打印出可用的处理单元的数量。
注:处理单元的数量可能与核心的数量不一定相同。
root@super:/# nproc
2
6. dmidecode
dmidecode命令显示有关cpu的某些信息,如:缓存信息、供应商信息和主频信息等。
root@super:/# dmidecode -t 4
# dmidecode 3.2
Getting SMBIOS data from sysfs.
SMBIOS 2.7 present.
Handle 0x0004, DMI type 4, 42 bytes
Processor Information
Socket Designation: CPU #000
Type: Central Processor
Family: Unknown
Manufacturer: GenuineIntel
ID: C3 06 03 00 FF FB 8B 1F
Version: Intel(R) Core(TM) i7-4710MQ CPU @ 2.50GHz
Voltage: 3.3 V
External Clock: Unknown
Max Speed: 30000 MHz
Current Speed: 2500 MHz
Status: Populated, Enabled
Upgrade: ZIF Socket
L1 Cache Handle: 0x0094
L2 Cache Handle: 0x0114
L3 Cache Handle: Not Provided
Serial Number: Not Specified
Asset Tag: Not Specified
Part Number: Not Specified
Core Count: 2
Core Enabled: 2
Characteristics:
64-bit capable
Multi-Core
Execute Protection
Handle 0x0004, DMI type 4, 42 bytes
7. cpuid
cpuid命令获取关于Intel和AMD x86处理器的cpuid信息。
没有cpuid命令,执行安装指令
apt-get install cpuid -y
root@super:/# cpuid
CPU 0:
vendor_id = "GenuineIntel"
version information (1/eax):
processor type = primary processor (0)
family = Intel Pentium Pro/II/III/Celeron/Core/Core 2/Atom, AMD Athlon/Duron, Cyrix M2, VIA C3 (6)
model = 0xc (12)
stepping id = 0x3 (3)
extended family = 0x0 (0)
extended model = 0x3 (3)
(simple synth) = Intel Core i5-4000 / i7-4000 / Mobile Core i3-4000 / i5-4000 / i7-4000 / Mobile Core i3-4000 / Mobile Core i5-4000 / Mobile Core i7-4000 / Pentium G3000 / Celeron G1800 / Mobile Pentium 3500U / Mobile Celeron 2900U / Xeon E3-1200 v3 (Mobile M) (Haswell), 22nm
miscellaneous (1/ebx):
process local APIC physical ID = 0x0 (0)
cpu count = 0x2 (2)
CLFLUSH line size = 0x8 (8)
brand index = 0x0 (0)
brand id = 0x00 (0): unknown
8. inxi
Inxi是一个Linux脚本,它使用其他程序生成一个结构良好、易于阅读的关于系统上各种硬件组件的报告。
没有改指令,Ubuntu执行如下指令
apt-get install inxi -y
root@super:/# inxi -C
CPU: Topology: Dual Core model: Intel Core i7-4710MQ bits: 64 type: MCP L2 cache: 6144 KiB
Speed: 2494 MHz min/max: N/A Core speeds (MHz): 1: 2494 2: 2494
GitHub 加速计划 / li / linux-dash
10.39 K
1.2 K
下载
A beautiful web dashboard for Linux
最近提交(Master分支:22 天前 )
186a802e
added ecosystem file for PM2 4 年前
5def40a3
Add host customization support for the NodeJS version 4 年前
更多推荐
已为社区贡献2条内容
所有评论(0)