如何获取Linux下CPU序列号? (linux下查看cpu sn号)

在Linux系统中,CPU序列号是一项重要的硬件信息,它可以帮助我们了解系统硬件设备的详细信息,并且可以用于系统诊断、优化以及安全检测等方面。那么,如何获取Linux下CPU序列号呢?本文将为大家介绍几种获取Linux下CPU序列号的方法,希望可以帮助到大家。

方法一:查看/sys文件系统

在Linux系统中,我们可以通过/sys文件系统查看系统硬件信息,包括CPU的序列号。下面是获取CPU序列号的步骤:

1. 进入/sys/devices/virtual/dmi/id/ 目录;

2. 使用cat命令查看 “product_uuid” 或 “product_serial” 文件的内容,其中 “product_uuid” 是唯一标示系统的GUID号码, “product_serial” 则是厂商提供的序列号。

$ cd /sys/devices/virtual/dmi/id/

$ cat product_uuid

39F02DE7-726F-DC11-7DC8-3D3C7EAEC083

$ cat product_serial

G8QN9D100836

方法二:使用lshw命令

lshw命令是一个用来显示硬件详细信息的命令。它可以显示系统中所有硬件设备的相关信息,包括CPU序列号。下面是获取CPU序列号的步骤:

1. 安装lshw命令;

$ sudo apt-get install lshw

2. 运行lshw命令,并使用-gpu, -cpu和-short等选项过滤结果。

$ sudo lshw -short -C cpu

H/W path Device Class Description

======================================================

product: Intel(R) Core(TM) i7-8700K CPU @ 3.70GHz

vendor: Intel Corp.

physical id: 4

bus info: cpu@0

size: 3918MHz

capacity: 4700MHz

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 dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdtscp x86-64 constant_tsc art arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc cpuid aperfmperf pni pclmulqdq dtes64 monitor ds_cpl vmx x est tm2 ssse3 sdbg fma cx16 xtpr pdcm pcid sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm abm 3dnowprefetch cpuid_fault epb invpcid_single pti tpr_shadow vnmi flexpriority ept vpid fsgase tsc_adjust bmi1 hle avx2 ep bmi2 erms invpcid rtm mpx rdseed adx ap clflushopt intel_pt xsaveopt xsavec xgetbv1 xsaves arat

$ sudo lshw -short -C memory

H/W path Device Class Description

===================================================

system Computer

/0 bus Motherboard

/0/0 memory 128KiB BIOS

/0/803 memory 64GiB System Memory

/0/803/0 memory 16GiB DIMM DDR4 Synchronous Unbuffered (Unregistered) 2666 MHz (0.4 ns)

/0/803/1 memory 16GiB DIMM DDR4 Synchronous Unbuffered (Unregistered) 2666 MHz (0.4 ns)

/0/803/2 memory 16GiB DIMM DDR4 Synchronous Unbuffered (Unregistered) 2666 MHz (0.4 ns)

/0/803/3 memory 16GiB DIMM DDR4 Synchronous Unbuffered (Unregistered) 2666 MHz (0.4 ns)

/0/1000 memory Flash Memory

方法三:使用dmidecode命令

dmidecode命令可以获取系统的DMI数据,包括BIOS、主板、CPU等等信息。 下面是获取CPU序列号的步骤:

1. 安装dmidecode命令;

$ sudo apt-get install dmidecode

2. 运行dmidecode命令,并使用-t选项指定类型为processor。

$ sudo dmidecode -t processor

# dmidecode 3.1

Getting BIOS data from sysfs.

BIOS 2.7 present.

Handle 0x0004, DMI type 4, 42 bytes

Processor Information

Socket Designation: U3E1

Type: Central Processor

Family: Core i7

Manufacturer: Intel(R) Corporation

ID: E3 06 09 00 FF FB EB BF

Signature: Type 0, Family 6, Model 158, Stepping 10

Flags:

FPU (Floating-point unit on-chip)

VME (Virtual mode extension)

DE (Debugging extension)

PSE (Page size extension)

TSC (Time stamp counter)

MSR (Model specific registers)

PAE (Physical address extension)

MCE (Machine check exception)

CX8 (CMPXCHG8 instruction supported)

APIC (On-chip APIC hardware supported)

SEP (Fast system call)

MTRR (Memory type range registers)

PGE (Page global enable)

MCA (Machine check architecture)

CMOV (Conditional move instruction supported)

PAT (Page attribute table)

PSE-36 (36-bit page size extension)

CLFSH (CLFLUSH instruction supported)

DS (Debug store)

ACPI (ACPI supported)

MMX (MMX technology supported)

FXSR (FXSAVE and FXSTOR instructions supported)

SSE (Streaming SIMD extensions)

SSE2 (Streaming SIMD extensions 2)

SS (Self-snoop)

HTT (Multi-threading)

TM (Thermal monitor supported)

PBE (Pending break enabled)

Version: Intel(R) Core(TM) i7-8700K CPU @ 3.70GHz

Voltage: 0.5 V / 1.2 V

External Clock: 100 MHz

Max Speed: 4700 MHz

Current Speed: 3918 MHz

Status: Populated, Enabled

Upgrade: Other

L1 Cache Handle: 0x0005

L2 Cache Handle: 0x0006

L3 Cache Handle: 0x0007

Serial Number: To Be Filled By O.E.M.

Asset Tag: To Be Filled By O.E.M.

Part Number: To Be Filled By O.E.M.

Core Count: 6

Core Enabled: 6

Thread Count: 12

Characteristics:

64-bit capable

以上就是获取Linux下CPU序列号的三种方法,其中通过/sys文件系统查看序列号和使用lshw命令获取序列号是最为常用的方法,而dmidecode命令则可以提供更为详细的CPU信息,包括CPU的家族、制造商、ID、速度等等内容。在进行系统维护或者检测工作时,了解CPU序列号的信息是非常有帮助的。

相关问题拓展阅读:

如何查看Ubuntu/Debian/CentOS等Linux系统的CPU信息

查看CPU信息

cat

/proc/cpuinfo

显示当前硬件信息

sudo

lshw

获取CPU序列号或者主板序列号

#CPU

ID

sudo

dmidecode

-t

|

grep

ID

#Serial

Number

sudo

dmidecode

|

grep

Serial

#CPU

sudo

dmidecode

-t

#BIOS

sudo

dmidecode

-t

#主州戚板:

sudo

dmidecode

-t

#OEM:

sudo

dmidecode

-t

显示当前内存枝租大小

free

-m

|grep

“Mem”

|

awk

‘{print

$2}’猛迹兆

查看硬盘温度

sudo

apt-get

install

hddtemp

sudo

hddtemp

/dev/sda

关于linux下查看cpu sn号的介绍到此就结束了,不知道你从中找到你需要的信息了吗 ?如果你还想了解更多这方面的信息,记得收藏关注本站。


数据运维技术 » 如何获取Linux下CPU序列号? (linux下查看cpu sn号)