dmidecode命令主要是通過DMI獲取主機的硬件信息,通常是在不打開計算機機箱的情況下使用該命令來查找硬件詳細信息。其輸出的信息包括BIOS、系統、主板、處理器、內存、緩存等等。
什么是DMI?DMI (Desktop Management Interface, DMI)的主要組成部分是Management InformationFormat (MIF)數據庫,這個數據庫包括了所有有關電腦系統和配件的信息。
1.常用用法如下(需要root權限):
[root@localhost ~]$ dmidecode # 打印所有硬件信息 [root@localhost ~]$ dmidecode -q # 打印所有硬件信息,比較簡潔
[root@localhost ~]$ dmidecode -h # 獲取幫助 [root@localhost ~]$ dmidecode | grep 'Product Name' # 以過濾的方式來查看指定的硬件信息 [root@localhost ~]$ dmidecode --type bios # 查看BIOS相關的硬件信息 [root@localhost ~]$ dmidecode --type system # 查看系統相關的硬件信息 [root@localhost ~]$ dmidecode --type baseboard # 查看主板相關的硬件信息 [root@localhost ~]$ dmidecode --type chassis # 查看機箱相關的硬件信息 [root@localhost ~]$ dmidecode --type processor # 查看處理器相關的硬件信息 [root@localhost ~]$ dmidecode --type memory # 查看內存相關的硬件信息
2.查看具體細項信息(以system為例,需root用戶)
[root@localhost ~]$ dmidecode -t 1 #查看system基本信息,-t等價於--type [root@localhost ~]$ dmidecode -t 15 #查看system Event信息 [root@localhost ~]$ dmidecode -t 23 #查看system Reset信息 [root@localhost ~]$ dmidecode -t 32 #查看system Boot信息 [root@localhost ~]$ dmidecode -t 1,15,23,32 #查看system所有信息,等價於dmidecode -t system
dmidecode支持的數字參數如下:
Type Information
--------------------------------------------
0 BIOS
1 System
2 Baseboard
3 Chassis
4 Processor
5 Memory Controller
6 Memory Module
7 Cache
8 Port Connector
9 System Slots
10 On Board Devices
11 OEM Strings
12 System Configuration Options
13 BIOS Language
14 Group Associations
15 System Event Log
16 Physical Memory Array
17 Memory Device
18 32-bit Memory Error
19 Memory Array Mapped Address
20 Memory Device Mapped Address
21 Built-in Pointing Device
22 Portable Battery
23 System Reset
24 Hardware Security
25 System Power Controls
26 Voltage Probe
27 Cooling Device
28 Temperature Probe
29 Electrical Current Probe
30 Out-of-band Remote Access
31 Boot Integrity Services
32 System Boot
33 64-bit Memory Error
34 Management Device
35 Management Device Component
36 Management Device Threshold Data
37 Memory Channel
38 IPMI Device
39 Power Supply
40 Additional Information
41 Onboard Devices Extended Information
42 Management Controller Host Interface
要獲得處理器方面的信息,示例如下:
[root@localhost ~]# dmidecode -t 4 # dmidecode 2.12-dmifs SMBIOS 3.0 present. # SMBIOS implementations newer than version 2.8 are not # fully supported by this version of dmidecode. Handle 0x006C, DMI type 4, 48 bytes #此處DMI type 4為查詢所需的type數字參數 Processor Information Socket Designation: SOCKET 0 Type: Central Processor Family: Xeon Manufacturer: Intel ID: F1 06 04 00 FF FB EB BF Signature: Type 0, Family 6, Model 79, Stepping 1 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) Xeon(R) CPU E5-2620 v4 @ 2.10GHz Voltage: 1.8 V External Clock: 100 MHz Max Speed: 4000 MHz Current Speed: 2100 MHz Status: Populated, Enabled Upgrade: Socket LGA2011-3 L1 Cache Handle: 0x0069 L2 Cache Handle: 0x006A L3 Cache Handle: 0x006B Serial Number: Not Specified Asset Tag: Not Specified Part Number: Not Specified Core Count: 8 Core Enabled: 8 Thread Count: 16 Characteristics: 64-bit capable Multi-Core Hardware Thread Execute Protection Enhanced Virtualization Power/Performance Control Handle 0x0070, DMI type 4, 48 bytes Processor Information Socket Designation: SOCKET 1 Type: Central Processor Family: Xeon Manufacturer: Intel ID: F1 06 04 00 FF FB EB BF Signature: Type 0, Family 6, Model 79, Stepping 1 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) Xeon(R) CPU E5-2620 v4 @ 2.10GHz Voltage: 1.8 V External Clock: 100 MHz Max Speed: 4000 MHz Current Speed: 2100 MHz Status: Populated, Enabled Upgrade: Socket LGA2011-3 L1 Cache Handle: 0x006D L2 Cache Handle: 0x006E L3 Cache Handle: 0x006F Serial Number: Not Specified Asset Tag: Not Specified Part Number: Not Specified Core Count: 8 Core Enabled: 8 Thread Count: 16 Characteristics: 64-bit capable Multi-Core Hardware Thread Execute Protection Enhanced Virtualization Power/Performance Control
打印所以硬件信息(簡潔)示例如下:
[root@localhost ~]$ dmidecode -q //BIOS相關的硬件信息 BIOS Information Vendor: Bochs Version: Bochs Release Date: 01/01/2011 Address: 0xE8000 Runtime Size: 96 kB ROM Size: 64 kB Characteristics: BIOS characteristics not supported Targeted content distribution is supported BIOS Revision: 1.0 //系統相關的硬件信息 System Information Manufacturer: Bochs # 廠商 Product Name: Bochs # 服務器型號 Version: Not Specified # 版本號 Serial Number: 641ab5b5-f6c0-431f-864c-4e750d27de04 # 主板序列號 UUID: 641AB5B5-F6C0-431F-864C-4E750D27DE04 # UUID Wake-up Type: Power Switch SKU Number: Not Specified Family: Not Specified //機箱相關的硬件信息 Chassis Information Manufacturer: Bochs Type: Other Lock: Not Present Version: Not Specified Serial Number: Not Specified Asset Tag: Not Specified Boot-up State: Safe Power Supply State: Safe Thermal State: Safe Security Status: Unknown OEM Information: 0x00000000 Height: Unspecified Number Of Power Cords: Unspecified //處理器相關的硬件信息 Processor Information Socket Designation: CPU 1 Type: Central Processor Family: Other Manufacturer: Bochs ID: F1 06 04 00 FF FB 8B 1F Version: Not Specified Voltage: Unknown External Clock: Unknown Max Speed: 2000 MHz Current Speed: 2000 MHz Status: Populated, Enabled Upgrade: Other //物理內存陣列 Physical Memory Array Location: Other Use: System Memory Error Correction Type: Multi-bit ECC Maximum Capacity: 2 GB Number Of Devices: 1 //內存設備 Memory Device Total Width: 64 bits Data Width: 64 bits Size: 2048 MB Form Factor: DIMM Set: None Locator: DIMM 0 Bank Locator: Not Specified Type: RAM Type Detail: None //內存陣列映射地址 Memory Array Mapped Address Starting Address: 0x00000000000 Ending Address: 0x0007FFFFFFF Range Size: 2 GB Partition Width: 1 //內存設備映射地址 Memory Device Mapped Address Starting Address: 0x00000000000 Ending Address: 0x0007FFFFFFF Range Size: 2 GB Partition Row Position: 1 //系統引導 System Boot Information Status: No errors detected
參考文檔: