dmidecode 是一个工具或命令,以人类可读的格局检索系统硬件的有用信息。dmidecode 可用于所有相似 Linux 的零碎 (RHEL, CentOS, Debian 和 SUSE)。dmidecode 代表 DMI (Desktop Management Interface) 它从 DMI 表中读取数据,并以人类可读的格局展现给咱们。DMI 表保留了零碎硬件的详细信息,如 BIOS,序列号,RAM 和 CPU 详细信息等,除此之外,dmidecode 还能够检索对于零碎反对的最大配置的详细信息。

在本文中,咱们将介绍 12 个Linux 零碎下 dmidecode 相干示例。

1) dmidecode 命令输入

When we run the dmidecode command then it displays the output on the
screen, in the output we have the records, each record has 4 different
values.

当咱们运行 dmidecode 命令时,会在屏幕上输入记录,每个记录有 4 个不同的值。

  • Handle – 惟一标识符号
  • Type – 它讲述的是硬件组成,在上面的示例中,DMI 类型 38 指的是 IPMI 设施
  • Size – 记录大小
  • Decoded value – 对于记录类型的信息,在上面的示例中,IPMI 设施的解码值是接口类型,规格版本,基址和寄存器间距

让咱们运行 dmidecode 命令

[root@linuxtechi ~]# dmidecode | more

输入如下所示

2) 用于 dmidecode 命令不同的 DMI 类型

以下是 dmidecode 命令中应用的 DMI 类型

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 Access31   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
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

3) 应用类型 id 显示硬件信息

在 dmidecode 命令中,咱们能够应用关键字或类型 id 来获取零碎的硬件信息。在例 2 中,咱们曾经列出了关键字及其类型 id。让咱们假如咱们想要显示零碎的 cache 信息,而后咱们能够运行上面的任何命令

[root@linuxtechi ~]# dmidecode -t cacheOr[root@linuxtechi ~]# dmidecode -t 7# dmidecode 2.12SMBIOS 2.5 present.Handle 0x009C, DMI type 7, 19 bytesCache Information        Socket Designation: L1-Cache        Configuration: Enabled, Not Socketed, Level 1        Operational Mode: Write Back        Location: Internal        Installed Size: 192 kB        Maximum Size: 192 kB        Supported SRAM Types:                Synchronous        Installed SRAM Type: Synchronous        Speed: Unknown        Error Correction Type: Single-bit ECC        System Type: Data        Associativity: 8-way Set-associativeHandle 0x009D, DMI type 7, 19 bytesCache Information        Socket Designation: L1-Cache        Configuration: Enabled, Not Socketed, Level 1        Operational Mode: Write Back        Location: Internal        Installed Size: 192 kB        Maximum Size: 192 kB        Supported SRAM Types:                Synchronous        Installed SRAM Type: Synchronous        Speed: Unknown        Error Correction Type: Single-bit ECC        System Type: Instruction        Associativity: 4-way Set-associative…………………………………………………………………………

4) 显示 BIOS 信息

运行 dmidecode 命令后输出 bios 作为类型

[root@linuxtechi ~]# dmidecode --type bios Or[root@linuxtechi ~]# dmidecode -t bios# dmidecode 2.12SMBIOS 2.5 present.Handle 0x0005, DMI type 0, 24 bytesBIOS Information        Vendor: Intel Corp.        Version: QSSC-S4R.QCI.01.00.0037.061120141015        Release Date: 06/11/2014        Address: 0xF0000        Runtime Size: 64 kB        ROM Size: 16384 kB        Characteristics:                PCI is supported                PNP is supported                BIOS is upgradeable                BIOS shadowing is allowed                Boot from CD is supported                Selectable boot is supported                EDD is supported                3.5"/2.88 MB floppy services are supported (int 13h)                Print screen service is supported (int 5h)                8042 keyboard services are supported (int 9h)                Serial services are supported (int 14h)                CGA/mono video services are supported (int 10h)                ACPI is supported                USB legacy is supported                LS-120 boot is supported                ATAPI Zip drive boot is supported                Function key-initiated network boot is supported                Targeted content distribution is supported        BIOS Revision: 17.18        Firmware Revision: 0.0

5) 显示机箱硬件信息

执行以下 dmidecode 命令显示机箱信息

[root@linuxtechi ~]# dmidecode -t chassis# dmidecode 2.12SMBIOS 2.5 present.Handle 0x0004, DMI type 3, 22 bytesChassis Information        Manufacturer: ..............................        Type: Main Server Chassis        Lock: Not Present        Version: 32S4RCS0010        Serial Number: QTFCVR1110136        Asset Tag: ....................        Boot-up State: Safe        Power Supply State: Safe        Thermal State: Safe        Security Status: Unknown        OEM Information: 0x01000181        Height: 1 U        Number Of Power Cords: 1        Contained Elements: 0        SKU Number: Not Specified

6) 显示底板硬件信息

执行上面的 dmidecode 命令来显示对于零碎底板的硬件信息

[root@linuxtechi ~]# dmidecode -t baseboard# dmidecode 2.12SMBIOS 2.5 present.Handle 0x0003, DMI type 2, 16 bytesBase Board Information        Manufacturer: QCI        Product Name: QSSC-S4R        Version: 31S4RMB00B0        Serial Number: LVR1340271        Asset Tag: ....................        Features:                Board is a hosting board                Board is replaceable        Location In Chassis: Not Specified        Chassis Handle: 0x0004        Type: Motherboard        Contained Object Handles: 0Handle 0x0027, DMI type 10, 6 bytesOn Board Device Information        Type: Video        Status: Enabled        Description: ServerEngines Pilot IIHandle 0x0028, DMI type 10, 6 bytesOn Board Device Information        Type: Ethernet        Status: Enabled        Description: Intel Dual GbE #1Handle 0x0029, DMI type 10, 6 bytesOn Board Device Information        Type: Ethernet        Status: Enabled        Description: Intel Dual GbE #2Handle 0x002A, DMI type 10, 6 bytesOn Board Device Information        Type: SATA Controller        Status: Enabled        Description: ICH10 Integrated SATA Controller

7) 显示零碎的硬件信息

要显示无关零碎的硬件信息(制造商、产品名称和序列号等),运行以下 dmidecode 命令

[root@linuxtechi ~]# dmidecode -t system# dmidecode 2.12SMBIOS 2.5 present.Handle 0x0002, DMI type 1, 27 bytesSystem Information        Manufacturer: QCI        Product Name: QSSC-S4R        Version: ....................        Serial Number: ............        UUID: 2DD583E2-4A58-11E0-A580-00101859A783        Wake-up Type: AC Power Restored        SKU Number: Not Specified        Family: Not SpecifiedHandle 0x002C, DMI type 12, 5 bytesSystem Configuration Options        Option 1: J5C3 2-3: Close to clear PasswordHandle 0x002D, DMI type 12, 5 bytesSystem Configuration Options        Option 1: J5C2 2-3: Close to clear CMOSHandle 0x002E, DMI type 12, 5 bytesSystem Configuration Options        Option 1: J6D1 2-3: Close for BIOS RecoveryHandle 0x002F, DMI type 12, 5 bytesSystem Configuration Options        Option 1: J5C1 2-3: Close to Force ME Update ModeHandle 0x0030, DMI type 12, 5 bytesSystem Configuration Options        Option 1: J9C3: SATA RAID KeyHandle 0x0031, DMI type 12, 5 bytesSystem Configuration Options        Option 1: J5A1 2-3: Close to Force BMC Update ModeHandle 0x0034, DMI type 32, 20 bytesSystem Boot Information        Status: No errors detected

8) 显示已装置的内存信息

要显示无关已装置的物理内存(RAM)的信息,请运行以下命令

[root@linuxtechi ~]# dmidecode -t 17 # dmidecode 2.12SMBIOS 2.5 present.Handle 0x0043, DMI type 17, 27 bytesMemory Device        Array Handle: 0x0035        Error Information Handle: Not Provided        Total Width: 72 bits        Data Width: 72 bits        Size: 4096 MB        Form Factor: DIMM        Set: 1        Locator: DIMM_1B        Bank Locator: MEM1 SLOT        Type: DDR3        Type Detail: Synchronous        Speed: 1067 MHz        Manufacturer: 0x0198        Serial Number: 0xA504DB27        Asset Tag: Unknown        Part Number: 9965426-047.A00LFHandle 0x0045, DMI type 17, 27 bytesMemory Device        Array Handle: 0x0035        Error Information Handle: Not Provided        Total Width: 72 bits        Data Width: 72 bits        Size: 4096 MB        Form Factor: DIMM        Set: 2        Locator: DIMM_1A        Bank Locator: MEM1 SLOT        Type: DDR3        Type Detail: Synchronous        Speed: 1067 MHz        Manufacturer: 0x830B        Serial Number: 0x6C443023…………………………………………………………

应用上面的 dmidecode 命令查找零碎反对的最大物理内存

[root@linuxtechi ~]# dmidecode -t 16 # dmidecode 2.12SMBIOS 2.5 present.Handle 0x0035, DMI type 16, 15 bytesPhysical Memory Array        Location: Proprietary Add-on Card        Use: System Memory        Error Correction Type: Multi-bit ECC        Maximum Capacity: 256 GB        Error Information Handle: Not Provided        Number Of Devices: 8Handle 0x0037, DMI type 16, 15 bytesPhysical Memory Array        Location: Proprietary Add-on Card        Use: System Memory        Error Correction Type: Multi-bit ECC        Maximum Capacity: 256 GB        Error Information Handle: Not Provided        Number Of Devices: 8Handle 0x0039, DMI type 16, 15 bytesPhysical Memory Array        Location: Proprietary Add-on Card        Use: System Memory        Error Correction Type: Multi-bit ECC        Maximum Capacity: 256 GB        Error Information Handle: Not Provided        Number Of Devices: 8……………………………………………………………

9) 显示对于处理器的硬件信息

执行以下 dmidecode 命令显示处理器或 CPU 插座的硬件信息

[root@linuxtechi ~]# dmidecode -t processoror[root@linuxtechi ~]# dmidecode -t 4# dmidecode 2.12SMBIOS 2.5 present.Handle 0x009B, DMI type 4, 40 bytesProcessor Information        Socket Designation: CPU1        Type: Central Processor        Family: Xeon MP        Manufacturer: Intel(R) Corporation        ID: E6 06 02 00 FF FB EB BF        Signature: Type 0, Family 6, Model 46, Stepping 6        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           E7540  @ 2.00GHz        Voltage: 1.2 V        External Clock: 133 MHz        Max Speed: 4000 MHz        Current Speed: 2000 MHz        Status: Populated, Enabled        Upgrade: Socket LGA1567        L1 Cache Handle: 0x009D        L2 Cache Handle: 0x009E        L3 Cache Handle: 0x009F        Serial Number: Not Specified        Asset Tag: Not Specified        Part Number: Not Specified        Core Count: 6        Core Enabled: 6        Thread Count: 12        Characteristics:                64-bit capable…………………………………………………

10) 显示无关 64 位内存谬误的信息

要显示零碎的 64 位内存错误信息,请运行以下命令

[root@linuxtechi ~]# dmidecode -t 33

11) 以十六进制输入 DMIDECODE 命令输入

如果您不想解码 dmidecode 命令的输入信息,但心愿将其转储为 16 进制格局,则能够在 dmidecode 命令中应用 -u 或 dump 选项,示例如下

[root@linuxtechi ~]# dmidecode -u -t 4or[root@linuxtechi ~]# dmidecode --dump -t 4

12 ) 显示 dmidecode 版本

应用上面的 dmidecode 命令显示它的版本

[root@linuxtechi ~]# dmidecode -V2.12[root@linuxtechi ~]#

我的开源我的项目

  • course-tencent-cloud(酷瓜云课堂 - gitee仓库)
  • course-tencent-cloud(酷瓜云课堂 - github仓库)