linux下查看硬件的信息(BIOS\CPU\MEM\主板命令dmidecode实例介绍



linux下查看硬件的信息(BIOS\CPU\MEM\主板命令实例介绍,服务器的cpu型号,和主板型号,我就纳闷了,cpu型号可以看,主板怎么看呀!只好google了,发现一很给力的命令dmidecode
我大致看了一下man手册,我把我用到的部分贴出来
-t, –type TYPE
Only display the entries of type TYPE. TYPE can be either a DMI type number, or a comma-separated list of type numbers, or a keyword from the fol-
lowing list: bios, system, baseboard, chassis, processor, memory, cache, connector, slot. Refer to the DMI TYPES section below for details. If
this option is used more than once, the set of displayed entries will be the union of all the given types. If TYPE is not provided or not valid,
a list of all valid keywords is printed and dmidecode exits with an error.

Additionally, type 126 is used for disabled entries and type 127 is an end-of-table marker. Types 128 to 255 are for OEM-specific data. dmidecode will
display these entries by default, but it can only decode them when the vendors have contributed documentation or code for them.

Keywords can be used instead of type numbers with –type. Each keyword is equivalent to a list of type numbers:

Keyword Types
——————————
bios 0, 13
system 1, 12, 15, 23, 32
baseboard 2, 10, 41
chassis 3
processor 4
memory 5, 6, 16, 17
cache 7
connector 8
slot 9

Keywords are matched case-insensitively. The following command lines are equivalent:

· dmidecode –type 0 –type 13

· dmidecode –type 0,13

· dmidecode –type bios

· dmidecode –type BIOS

其他更详细的信息自己去man吧,下面举例
查看cpu信息

[root@localhost ~]# dmidecode -t 4
# dmidecode 2.10
SMBIOS 2.4 present.

Handle 0×0400, DMI type 4, 40 bytes
Processor Information
Socket Designation: CPU1
Type: Central Processor
Family: Xeon
Manufacturer: Intel
ID: F7 06 00 00 FF FB EB BF
Signature: Type 0, Family 6, Model 15, Stepping 7
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 (Fast floating-point save and restore)
SSE (Streaming SIMD extensions)
SSE2 (Streaming SIMD extensions 2)
SS (Self-snoop)
HTT (Hyper-threading technology)
TM (Thermal monitor supported)
PBE (Pending break enabled)
Version: Intel(R) Xeon(R) CPU E5345 @ 2.33GHz
Voltage: 1.4 V
External Clock: 1333 MHz
Max Speed: 3600 MHz
Current Speed: 2333 MHz
Status: Populated, Enabled
Upgrade: Socket LGA771
L1 Cache Handle: 0×0700
L2 Cache Handle: 0×0701
L3 Cache Handle: 0×0702
Serial Number: Not Specified
Asset Tag: Not Specified
Part Number: Not Specified
Core Count: 4
Core Enabled: 4
Thread Count: 4
Characteristics:
64-bit capable

Handle 0×0401, DMI type 4, 40 bytes
Processor Information
Socket Designation: CPU2
Type: Central Processor
Family: Xeon
Manufacturer: Intel
ID: F7 06 00 00 FF FB EB BF
Signature: Type 0, Family 6, Model 15, Stepping 7
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 (Fast floating-point save and restore)
SSE (Streaming SIMD extensions)
SSE2 (Streaming SIMD extensions 2)
SS (Self-snoop)
HTT (Hyper-threading technology)
TM (Thermal monitor supported)
PBE (Pending break enabled)
Version: Intel(R) Xeon(R) CPU E5345 @ 2.33GHz
Voltage: 1.4 V
External Clock: 1333 MHz
Max Speed: 3600 MHz
Current Speed: 2333 MHz
Status: Populated, Idle
Upgrade: Socket LGA771
L1 Cache Handle: 0×0703
L2 Cache Handle: 0×0704
L3 Cache Handle: 0×0705
Serial Number: Not Specified
Asset Tag: Not Specified
Part Number: Not Specified
Core Count: 4
Core Enabled: 4
Thread Count: 4
Characteristics:
64-bit capable

[root@localhost ~]#
可以看出我这上面有2个Intel(R) Xeon(R) CPU E5345 @ 2.33GHz cpu,是4核4线程,还支持64位等等的信息。

查看当前cpu工作在什么模式之下
[root@localhost ~]# uname -a
Linux localhost 2.6.18-194.32.1.el5PAE #1 SMP Wed Jan 5 18:43:13 EST 2011 i686 i686 i386 GNU/Linux
[root@localhost ~]# getconf LONG_BIT
32
[root@localhost ~]#

我更喜欢用的方法
[root@localhost ~]# cat /proc/cpuinfo
processor : 0
vendor_id : GenuineIntel
cpu family : 6
model : 15
model name : Intel(R) Xeon(R) CPU E5345 @ 2.33GHz
stepping : 7
cpu MHz : 2327.562
cache size : 4096 KB
physical id : 0
siblings : 4
core id : 0
cpu cores : 4
apicid : 0
fdiv_bug : no
hlt_bug : no
f00f_bug : no
coma_bug : no
fpu : yes
fpu_exception : yes
cpuid level : 10
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 nx lm constant_tsc pni monitor ds_cpl vmx est tm2 ssse3 cx16 xtpr lahf_lm
bogomips : 4655.12

processor : 1
vendor_id : GenuineIntel
cpu family : 6
model : 15
model name : Intel(R) Xeon(R) CPU E5345 @ 2.33GHz
stepping : 7
cpu MHz : 2327.562
cache size : 4096 KB
physical id : 0
siblings : 4
core id : 1
cpu cores : 4
apicid : 1
fdiv_bug : no
hlt_bug : no
f00f_bug : no
coma_bug : no
fpu : yes
fpu_exception : yes
cpuid level : 10
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 nx lm constant_tsc pni monitor ds_cpl vmx est tm2 ssse3 cx16 xtpr lahf_lm
bogomips : 4655.04

processor : 2
vendor_id : GenuineIntel
cpu family : 6
model : 15
model name : Intel(R) Xeon(R) CPU E5345 @ 2.33GHz
stepping : 7
cpu MHz : 2327.562
cache size : 4096 KB
physical id : 0
siblings : 4
core id : 2
cpu cores : 4
apicid : 2
fdiv_bug : no
hlt_bug : no
f00f_bug : no
coma_bug : no
fpu : yes
fpu_exception : yes
cpuid level : 10
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 nx lm constant_tsc pni monitor ds_cpl vmx est tm2 ssse3 cx16 xtpr lahf_lm
bogomips : 4655.07

processor : 3
vendor_id : GenuineIntel
cpu family : 6
model : 15
model name : Intel(R) Xeon(R) CPU E5345 @ 2.33GHz
stepping : 7
cpu MHz : 2327.562
cache size : 4096 KB
physical id : 0
siblings : 4
core id : 3
cpu cores : 4
apicid : 3
fdiv_bug : no
hlt_bug : no
f00f_bug : no
coma_bug : no
fpu : yes
fpu_exception : yes
cpuid level : 10
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 nx lm constant_tsc pni monitor ds_cpl vmx est tm2 ssse3 cx16 xtpr lahf_lm
bogomips : 4655.08

processor : 4
vendor_id : GenuineIntel
cpu family : 6
model : 15
model name : Intel(R) Xeon(R) CPU E5345 @ 2.33GHz
stepping : 7
cpu MHz : 2327.562
cache size : 4096 KB
physical id : 1
siblings : 4
core id : 0
cpu cores : 4
apicid : 4
fdiv_bug : no
hlt_bug : no
f00f_bug : no
coma_bug : no
fpu : yes
fpu_exception : yes
cpuid level : 10
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 nx lm constant_tsc pni monitor ds_cpl vmx est tm2 ssse3 cx16 xtpr lahf_lm
bogomips : 4655.08


processor : 5
vendor_id : GenuineIntel
cpu family : 6
model : 15
model name : Intel(R) Xeon(R) CPU E5345 @ 2.33GHz
stepping : 7
cpu MHz : 2327.562
cache size : 4096 KB
physical id : 1
siblings : 4
core id : 1
cpu cores : 4
apicid : 5
fdiv_bug : no
hlt_bug : no
f00f_bug : no
coma_bug : no
fpu : yes
fpu_exception : yes
cpuid level : 10
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 nx lm constant_tsc pni monitor ds_cpl vmx est tm2 ssse3 cx16 xtpr lahf_lm
bogomips : 4655.09

processor : 6
vendor_id : GenuineIntel
cpu family : 6
model : 15
model name : Intel(R) Xeon(R) CPU E5345 @ 2.33GHz
stepping : 7
cpu MHz : 2327.562
cache size : 4096 KB
physical id : 1
siblings : 4
core id : 2
cpu cores : 4
apicid : 6
fdiv_bug : no
hlt_bug : no
f00f_bug : no
coma_bug : no
fpu : yes
fpu_exception : yes
cpuid level : 10
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 nx lm constant_tsc pni monitor ds_cpl vmx est tm2 ssse3 cx16 xtpr lahf_lm
bogomips : 4655.07

processor : 7
vendor_id : GenuineIntel
cpu family : 6
model : 15
model name : Intel(R) Xeon(R) CPU E5345 @ 2.33GHz
stepping : 7
cpu MHz : 2327.562
cache size : 4096 KB
physical id : 1
siblings : 4
core id : 3
cpu cores : 4
apicid : 7
fdiv_bug : no
hlt_bug : no
f00f_bug : no
coma_bug : no
fpu : yes
fpu_exception : yes
cpuid level : 10
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 nx lm constant_tsc pni monitor ds_cpl vmx est tm2 ssse3 cx16 xtpr lahf_lm
bogomips : 4655.09

[root@localhost ~]#
下面根据输出的信息 我们来进行筛选有用的信息,
首先看cpu的型号
[root@localhost ~]# cat /proc/cpuinfo | grep name | awk -F : ‘{print $2}’ | uniq -c
8 Intel(R) Xeon(R) CPU E5345 @ 2.33GHz
[root@localhost ~]#
这里我统计了一下次数,说明是8个逻辑上的cpu,我们来进一步的筛选
[root@localhost ~]# cat /proc/cpuinfo | grep “physical id” | uniq -c
4 physical id : 0
4 physical id : 1
[root@localhost ~]#
通过这个筛选我们就知道是有2个物理cpu,我们再来筛选一下其他字段,
[root@localhost ~]# cat /proc/cpuinfo | grep “core”
core id : 0
cpu cores : 4
core id : 1
cpu cores : 4
core id : 2
cpu cores : 4
core id : 3
cpu cores : 4
core id : 0
cpu cores : 4
core id : 1
cpu cores : 4
core id : 2
cpu cores : 4
core id : 3
cpu cores : 4
[root@localhost ~]#
在这个文件我们还能查看主频
[root@localhost ~]# cat /proc/cpuinfo | grep “MH” | uniq -c
8 cpu MHz : 2327.562
[root@localhost ~]#
查看是否支持64位
[root@localhost ~]# cat /proc/cpuinfo | grep “flags” | uniq -c
8 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 nx lm constant_tsc pni monitor ds_cpl vmx est tm2 ssse3 cx16 xtpr lahf_lm
发现其中有lm,lm的意思是long mode 说明支持64位

还有一个命令也能把硬件信息给详细的列出来,比如我列出cpu的个数
[root@localhost ~]# dmesg | grep “CPU: Physical Processor ID:” | uniq -c
4 CPU: Physical Processor ID: 0
4 CPU: Physical Processor ID: 1
[root@localhost ~]#
具体怎么筛选,就需要好好阅读dmesg的输出信息了

查看内存使用情况的名就很多了有free,top,htop;还能查看/proc/meminfo
这里我主要说下内存的信息
[root@localhost ~]# dmidecode -t 16
# dmidecode 2.10
SMBIOS 2.4 present.

Handle 0×1000, DMI type 16, 15 bytes
Physical Memory Array
Location: System Board Or Motherboard
Use: System Memory
Error Correction Type: Multi-bit ECC
Maximum Capacity: 32 GB
Error Information Handle: Not Provided
Number Of Devices: 8

[root@localhost ~]#
可以看出最大支持32G的内存,有8个内存插槽
[root@localhost ~]# dmidecode -t 17
# dmidecode 2.10
SMBIOS 2.4 present.

Handle 0×1100, DMI type 17, 28 bytes
Memory Device
Array Handle: 0×1000
Error Information Handle: Not Provided
Total Width: 72 bits
Data Width: 64 bits
Size: 2048 MB
Form Factor: FB-DIMM
Set: 1
Locator: DIMM1
Bank Locator: Not Specified
Type: DDR2 FB-DIMM
Type Detail: Synchronous
Speed: 667 MHz
Manufacturer: 01917FB30000
Serial Number: 38540000
Asset Tag: 010000
Part Number: DATARAM 65508
Rank: 2

Handle 0×1101, DMI type 17, 28 bytes
Memory Device
Array Handle: 0×1000
Error Information Handle: Not Provided
Total Width: 72 bits
Data Width: 64 bits
Size: 2048 MB
Form Factor: FB-DIMM
Set: 1
Locator: DIMM2
Bank Locator: Not Specified
Type: DDR2 FB-DIMM
Type Detail: Synchronous
Speed: 667 MHz
Manufacturer: 01917FB30000
Serial Number: 71670000
Asset Tag: 010000
Part Number: DATARAM 65508
Rank: 2

Handle 0×1102, DMI type 17, 28 bytes
Memory Device
Array Handle: 0×1000
Error Information Handle: Not Provided
Total Width: 72 bits
Data Width: 64 bits
Size: No Module Installed
Form Factor: FB-DIMM
Set: 2
Locator: DIMM3
Bank Locator: Not Specified
Type: DDR2 FB-DIMM
Type Detail: Synchronous
Speed: Unknown
Manufacturer:
Serial Number:
Asset Tag:
Part Number:
Rank: Unknown

Handle 0×1103, DMI type 17, 28 bytes
Memory Device
Array Handle: 0×1000
Error Information Handle: Not Provided
Total Width: 72 bits
Data Width: 64 bits
Size: No Module Installed
Form Factor: FB-DIMM
Set: 2
Locator: DIMM4
Bank Locator: Not Specified
Type: DDR2 FB-DIMM
Type Detail: Synchronous
Speed: Unknown
Manufacturer:
Serial Number:
Asset Tag:
Part Number:
Rank: Unknown

Handle 0×1104, DMI type 17, 28 bytes
Memory Device
Array Handle: 0×1000
Error Information Handle: Not Provided
Total Width: 72 bits
Data Width: 64 bits
Size: No Module Installed
Form Factor: FB-DIMM
Set: 3
Locator: DIMM5
Bank Locator: Not Specified
Type: DDR2 FB-DIMM
Type Detail: Synchronous
Speed: Unknown
Manufacturer:
Serial Number:
Asset Tag:
Part Number:
Rank: Unknown

Handle 0×1105, DMI type 17, 28 bytes
Memory Device
Array Handle: 0×1000
Error Information Handle: Not Provided
Total Width: 72 bits
Data Width: 64 bits
Size: No Module Installed
Form Factor: FB-DIMM
Set: 3
Locator: DIMM6
Bank Locator: Not Specified
Type: DDR2 FB-DIMM
Type Detail: Synchronous
Speed: Unknown
Manufacturer:
Serial Number:
Asset Tag:
Part Number:
Rank: Unknown

Handle 0×1106, DMI type 17, 28 bytes
Memory Device
Array Handle: 0×1000
Error Information Handle: Not Provided
Total Width: 72 bits
Data Width: 64 bits
Size: No Module Installed
Form Factor: FB-DIMM
Set: 4
Locator: DIMM7
Bank Locator: Not Specified
Type: DDR2 FB-DIMM
Type Detail: Synchronous
Speed: Unknown
Manufacturer:
Serial Number:
Asset Tag:
Part Number:
Rank: Unknown

Handle 0×1107, DMI type 17, 28 bytes
Memory Device
Array Handle: 0×1000
Error Information Handle: Not Provided
Total Width: 72 bits
Data Width: 64 bits
Size: No Module Installed
Form Factor: FB-DIMM
Set: 4
Locator: DIMM8
Bank Locator: Not Specified
Type: DDR2 FB-DIMM
Type Detail: Synchronous
Speed: Unknown
Manufacturer:
Serial Number:
Asset Tag:
Part Number:
Rank: Unknown

[root@localhost ~]#
可以看出来是DDR2 FB-DIMM的内存

查看主板信息
[root@localhost ~]# dmidecode -t 1
# dmidecode 2.10
SMBIOS 2.4 present.

Handle 0×0100, DMI type 1, 27 bytes
System Information
Manufacturer: Dell Inc.
Product Name: PowerEdge 2950
Version: Not Specified
Serial Number: CS2452X
UUID: 44454C4C-5300-1032-8034-C3C04F353258
Wake-up Type: Power Switch
SKU Number: Not Specified
Family: Not Specified

[root@localhost ~]# dmesg | grep Mem
Memory for crash kernel (0×0 to 0×0) notwithin permissible range
HighMem zone: 1015808 pages, LIFO batch:31
Memory: 4145156k/4980736k available (2177k kernel code, 47444k reserved, 900k data, 228k init, 3276448k highmem)
[root@localhost ~]#