Linux dmidecode 命令及实际示例

LinuxLinuxBeginner
立即练习

💡 本教程由 AI 辅助翻译自英文原版。如需查看原文,您可以 切换至英文原版

介绍

在本实验中,我们将介绍 dmidecode 命令,这是一个在 Linux 系统上检索详细硬件信息的强大工具。dmidecode 命令可以显示广泛的硬件细节,包括系统制造商、型号名称、序列号、BIOS 版本、处理器信息和内存配置。我们将从安装 dmidecode 包开始,然后使用该命令来探索系统的硬件规格。此外,我们还将演示如何使用 dmidecode 提取特定的硬件细节,例如处理器信息。

Linux 命令速查表


Skills Graph

%%%%{init: {'theme':'neutral'}}%%%% flowchart RL linux(("`Linux`")) -.-> linux/BasicFileOperationsGroup(["`Basic File Operations`"]) linux(("`Linux`")) -.-> linux/UserandGroupManagementGroup(["`User and Group Management`"]) linux(("`Linux`")) -.-> linux/PackagesandSoftwaresGroup(["`Packages and Softwares`"]) linux/BasicFileOperationsGroup -.-> linux/cat("`File Concatenating`") linux/UserandGroupManagementGroup -.-> linux/sudo("`Privilege Granting`") linux/PackagesandSoftwaresGroup -.-> linux/apt("`Package Handling`") subgraph Lab Skills linux/cat -.-> lab-422645{{"`Linux dmidecode 命令及实际示例`"}} linux/sudo -.-> lab-422645{{"`Linux dmidecode 命令及实际示例`"}} linux/apt -.-> lab-422645{{"`Linux dmidecode 命令及实际示例`"}} end

dmidecode 命令介绍

在本步骤中,我们将介绍 dmidecode 命令,这是一个在 Linux 系统上检索详细硬件信息的强大工具。

dmidecode 命令是一款免费软件,它根据 SMBIOS/DMI 标准从 BIOS 中读取系统的硬件信息。它可以显示广泛的硬件信息,包括系统制造商、型号名称、序列号、BIOS 版本、处理器详细信息、内存配置等。

让我们从安装 dmidecode 包开始:

sudo apt-get update
sudo apt-get install -y dmidecode

现在,我们可以使用 dmidecode 命令来显示系统的硬件信息:

sudo dmidecode

示例输出:

## dmidecode 3.3
Getting SMBIOS data from sysfs.
SMBIOS 3.2.0 present.

Handle 0x0001, DMI type 1, 27 bytes
System Information
        Manufacturer: VMware, Inc.
        Product Name: VMware Virtual Platform
        Version: None
        Serial Number: VMware-42 1d 93 c1 d1 2f 2a 19-5a 1c 4f 3b 6a 4f 9a 6d
        UUID: 421d93c1-d12f-2a19-5a1c-4f3b6a4f9a6d
        Wake-up Type: Power Switch
        SKU Number: Not Specified
        Family: Virtual Machine

输出提供了关于系统硬件的丰富信息,包括制造商、产品名称、序列号、UUID 等。

我们还可以使用 dmidecode 命令提取特定的硬件细节。例如,要获取处理器信息,可以使用以下命令:

sudo dmidecode -t processor

示例输出:

## dmidecode 3.3
Getting SMBIOS data from sysfs.
SMBIOS 3.2.0 present.

Handle 0x0003, DMI type 3, 21 bytes
Chassis Information
        Manufacturer: VMware, Inc.
        Type: Virtual Machine
        Lock: Not Present
        Version: None
        Serial Number: VMware-42 1d 93 c1 d1 2f 2a 19-5a 1c 4f 3b 6a 4f 9a 6d
        Asset Tag: Not Specified
        Boot-up State: Safe
        Power Supply State: Safe
        Thermal State: Safe
        Security Status: None

此命令显示了系统处理器的详细信息,包括制造商、型号、速度和其他相关细节。

dmidecode 命令提供了丰富的硬件信息,对于系统管理员和 IT 专业人员来说是一个非常有价值的工具。在接下来的步骤中,我们将探索更多使用 dmidecode 检索特定硬件细节的实际示例。

显示系统硬件信息

在本步骤中,我们将使用 dmidecode 命令来显示系统硬件组件的详细信息。

首先,让我们使用 dmidecode 命令显示系统的整体信息:

sudo dmidecode -t system

示例输出:

## dmidecode 3.3
Getting SMBIOS data from sysfs.
SMBIOS 3.2.0 present.

Handle 0x0001, DMI type 1, 27 bytes
System Information
        Manufacturer: VMware, Inc.
        Product Name: VMware Virtual Platform
        Version: None
        Serial Number: VMware-42 1d 93 c1 d1 2f 2a 19-5a 1c 4f 3b 6a 4f 9a 6d
        UUID: 421d93c1-d12f-2a19-5a1c-4f3b6a4f9a6d
        Wake-up Type: Power Switch
        SKU Number: Not Specified
        Family: Virtual Machine

此命令提供了系统制造商、产品名称、序列号、UUID 等相关信息。

接下来,让我们显示系统处理器的信息:

sudo dmidecode -t processor

示例输出:

## dmidecode 3.3
Getting SMBIOS data from sysfs.
SMBIOS 3.2.0 present.

Handle 0x0003, DMI type 3, 21 bytes
Chassis Information
        Manufacturer: VMware, Inc.
        Type: Virtual Machine
        Lock: Not Present
        Version: None
        Serial Number: VMware-42 1d 93 c1 d1 2f 2a 19-5a 1c 4f 3b 6a 4f 9a 6d
        Asset Tag: Not Specified
        Boot-up State: Safe
        Power Supply State: Safe
        Thermal State: Safe
        Security Status: None

此命令提供了系统处理器的详细信息,包括制造商、型号、速度等相关信息。

最后,让我们显示系统内存的信息:

sudo dmidecode -t memory

示例输出:

## dmidecode 3.3
Getting SMBIOS data from sysfs.
SMBIOS 3.2.0 present.

Handle 0x0017, DMI type 17, 40 bytes
Memory Device
        Array Handle: 0x0016
        Error Information Handle: Not Provided
        Total Width: 64 bits
        Data Width: 64 bits
        Size: 16384 MB
        Form Factor: DIMM
        Set: None
        Locator: DIMM 0
        Bank Locator: DIMM 0
        Type: DDR4
        Type Detail: Synchronous
        Speed: 2400 MT/s
        Manufacturer: VMware
        Serial Number: VMware-42 1d 93 c1 d1 2f 2a 19-5a 1c 4f 3b 6a 4f 9a 6d
        Asset Tag: Not Specified
        Part Number: VMware Virtual RAM
        Rank: 2
        Configured Memory Speed: 2400 MT/s

此命令提供了系统内存的详细信息,包括大小、类型、速度等相关信息。

dmidecode 命令可用于显示广泛的硬件信息,具体显示的信息将取决于系统的硬件配置。

提取特定硬件详细信息

在本步骤中,我们将探索如何使用 dmidecode 命令从系统中提取特定的硬件详细信息。

首先,让我们提取 BIOS 信息:

sudo dmidecode -t bios

示例输出:

## dmidecode 3.3
Getting SMBIOS data from sysfs.
SMBIOS 3.2.0 present.

Handle 0x0000, DMI type 0, 24 bytes
BIOS Information
        Vendor: Phoenix Technologies LTD
        Version: 6.00
        Release Date: 12/12/2018
        Address: 0xE8000
        Runtime Size: 128 kB
        ROM Size: 1024 kB
        Characteristics:
                PCI is supported
                BIOS is upgradeable
                BIOS shadowing is allowed
                Boot from CD is supported
                Selectable boot is supported
                BIOS ROM is socketed
                EDD is supported
                5.25"/1.2 MB floppy services are supported (int 13h)
                3.5"/720 kB floppy services are supported (int 13h)
                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)
                Printer services are supported (int 17h)
                ACPI is supported
                USB legacy is supported
                BIOS boot specification is supported
                Targeted content distribution is supported
                UEFI is supported

此命令显示了系统 BIOS 的详细信息,包括供应商、版本、发布日期以及各种 BIOS 特性。

接下来,让我们提取系统机箱的信息:

sudo dmidecode -t chassis

示例输出:

## dmidecode 3.3
Getting SMBIOS data from sysfs.
SMBIOS 3.2.0 present.

Handle 0x0003, DMI type 3, 21 bytes
Chassis Information
        Manufacturer: VMware, Inc.
        Type: Virtual Machine
        Lock: Not Present
        Version: None
        Serial Number: VMware-42 1d 93 c1 d1 2f 2a 19-5a 1c 4f 3b 6a 4f 9a 6d
        Asset Tag: Not Specified
        Boot-up State: Safe
        Power Supply State: Safe
        Thermal State: Safe
        Security Status: None

此命令显示了系统机箱的信息,包括制造商、类型、序列号以及各种机箱状态。

最后,让我们提取系统插槽的信息:

sudo dmidecode -t slot

示例输出:

## dmidecode 3.3
Getting SMBIOS data from sysfs.
SMBIOS 3.2.0 present.

Handle 0x0008, DMI type 9, 17 bytes
System Slot Information
        Designation: PCI Slot 1
        Type: 32-bit PCI
        Current Usage: Available
        Length: Long
        ID: 1
        Characteristics:
                3.3 V is provided
                PME signal is supported

Handle 0x0009, DMI type 9, 17 bytes
System Slot Information
        Designation: PCI Slot 2
        Type: 32-bit PCI
        Current Usage: Available
        Length: Long
        ID: 2
        Characteristics:
                3.3 V is provided
                PME signal is supported

此命令显示了系统扩展插槽的信息,包括插槽名称、类型、当前使用状态以及各种插槽特性。

dmidecode 命令提供了丰富的硬件详细信息,具体显示的信息将取决于系统的硬件配置。

总结

在本实验中,我们介绍了 dmidecode 命令,这是一个在 Linux 系统上检索详细硬件信息的强大工具。我们了解到,dmidecode 可以显示广泛的硬件细节,包括系统制造商、型号名称、序列号、BIOS 版本、处理器信息和内存配置。我们还探索了如何使用 dmidecode 命令提取特定的硬件细节,例如处理器信息。本实验提供了实际示例和分步说明,帮助用户理解并有效使用 dmidecode 命令。

Linux 命令速查表

您可能感兴趣的其他 Linux 教程