在Linux下查看CPU相关信息可以通过多种命令实现:
一、基础概念
二、相关优势
三、应用场景
四、查看示例
cat /proc/cpuinfo
,会得到类似如下的输出(部分示例):processor : 0
vendor_id : GenuineIntel
cpu family : 6
model : 142
model name : Intel(R) Core(TM) i5 - 10200H CPU @ 2.40GHz
stepping : 10
microcode : 0x85
cpu MHz : 2400.000
cache size : 6144 KB
physical id : 0
siblings : 8
core id : 0
cpu cores : 4
apicid : 0
initial apicid : 0
fpu : yes
fpu_exception : yes
cpuid level : 22
wp : yes
flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdtscp lm constant_tsc art arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc cpuid aperfmperf pni pclmulqdq dtes64 monitor ds_cpl vmx smx est tm2 ssse3 sdbg fma cx16 xtpr pdcm pcid sse4_1 sse4_2 x2apic popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm abm 3dnowprefetch cpuid_fault epb invpcid_single pti ssbd ibrs ibpb stibp tpr_shadow vnmi flexpriority ept vpid ept_ad fsgsbase tsc_adjust bmi1 avx2 smep bmi2 erms invpcid mpx rdseed adx smap xsaveopt dtherm ida arat pln pts hwp hwp_notify hwp_act_window hwp_epp md_clear flush_l1d
bugs : cpu_meltdown spectre_v1 spectre_v2 spec_store_bypass l1tf mds swapgs itlb_multihit
bogomips : 4800.00
clflush size : 64
cache_alignment : 64
address sizes : 46 bits physical, 48 bits virtual
power management:
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) i5 - 10200H CPU @ 2.40GHz
Stepping: 10
CPU MHz: 2400.000
BogoMIPS: 4800.00
Virtualization: VT - x
L1d cache: 32K
L1i cache: 32K
L2 cache: 256K
L3 cache: 6144K
NUMA node0 CPU(s): 0 - 7
如果在查看CPU信息时遇到问题,例如某些信息显示不正确或者命令无法执行:
sudo apt - get update && sudo apt - get upgrade
命令更新系统(这会更新包括内核在内的各种软件包)。对于基于Red Hat的系统,可以使用yum update
命令。lscpu
命令无法执行,可能是系统缺少相关的库文件。可以尝试重新安装util - linux
包(在基于Debian或Ubuntu的系统中使用sudo apt - get install --reinstall util - linux
,在基于Red Hat的系统中使用yum reinstall util - linux
)。cat /proc/cpuinfo
无法正常显示内容,可能是文件系统损坏或者内核模块出现问题。可以尝试使用文件系统检查工具(如fsck
)检查和修复文件系统,或者重新加载相关内核模块(具体模块需要根据系统日志进一步确定)。领取专属 10元无门槛券
手把手带您无忧上云