dmidecode 命令详解

| 选择喜欢的代码风格  


dmidecode 命令安装:

-bash/zsh: dmidecode command not found

# Windows (WSL2)
sudo apt-get update sudo apt-get install dmidecode

# Debian
apt-get install dmidecode

# Ubuntu
apt-get install dmidecode

# Alpine
apk add dmidecode

# Arch Linux
pacman -S dmidecode

# Kali Linux
apt-get install dmidecode

# CentOS
yum install dmidecode

# Fedora
dnf install dmidecode

# Raspbian
apt-get install dmidecode

# Dockerfile

# Docker
docker run dmidecode

dmidecode 命令补充说明:

dmidecode 是一个 DMI table 的 decoder。根据 SMBIOS / DMI 标准报告有关 BIOS 中描述的系统硬件信息。 这些信息通常包括系统制造商、型号名称、序列号、BIOS 版本、资产标签以及许多其他详细信息,这些详细信息的程度取决于制造商。 包括 CPU 插槽、扩展插槽(例如 AGP、PCI、ISA)和内存模块插槽的使用状态,以及 I/O 端口列表(例如串行、并行、USB)。

DMI 数据可用于根据特定硬件启用或禁用内核代码的特定部分。 因此,dmidecode 的用途之一是让内核开发人员检测系统“签名”并在需要时将其添加到内核源代码中。Dmidecode 最初由 Alan Cox 编写,然后进一步开发,目前由 Jean Delvare 再次维护,Anton Arapov 临时维护了 5 年。 它是根据通用公共许可证(GPL)发布的。 有关更多详细信息,您应该查看源代码附带的作者和许可证文件。

dmidecode 命令的坑:

请注意,DMI 数据已被证明太不可靠,不要盲目信任。 Dmidecode 不会扫描您的硬件,它只报告 BIOS 告诉它的内容

dmidecode 命令语法:

dmidecode [OPTIONS]

dmidecode 命令选项:

-d, --dev-mem FILE
      Read memory from device FILE (default: /dev/mem)

-q, --quiet
      Be less verbose. Unknown, inactive and OEM-specific entries are not displayed. Meta-data and handle references are hidden.

-s, --string KEYWORD
      Only display the value of the DMI string identified by KEYWORD.  KEYWORD must be a keyword from the following list: bios-vendor, bios-version, bios-release-date, bios-revision, firmware-
      revision,  system-manufacturer,  system-product-name, system-version, system-serial-number, system-uuid, system-family, baseboard-manufacturer, baseboard-product-name, baseboard-version,
      baseboard-serial-number, baseboard-asset-tag, chassis-manufacturer, chassis-type, chassis-version,  chassis-serial-number,  chassis-asset-tag,  processor-family,  processor-manufacturer,
      processor-version, processor-frequency.  Each keyword corresponds to a given DMI type and a given offset within this entry type.  Not all strings may be meaningful or even defined on all
      systems. Some keywords may return more than one result on some systems (e.g.  processor-version on a multi-processor system).  If KEYWORD is not provided or not  valid,  a  list  of  all
      valid keywords is printed and dmidecode exits with an error.  This option cannot be used more than once.

      Note:  on  Linux,  most  of these strings can alternatively be read directly from sysfs, typically from files under /sys/devices/virtual/dmi/id.  Most of these files are even readable by
      regular users.

-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 following  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.

-H, --handle HANDLE
      Only display the entry whose handle matches HANDLE.  HANDLE is a 16-bit integer.

-u, --dump
      Do not decode the entries, dump their contents as hexadecimal instead.  Note that this is still a text output, no binary data will be thrown upon you. The strings attached to each  entry
      are displayed as both hexadecimal and ASCII. This option is mainly useful for debugging.

   --dump-bin FILE
      Do not decode the entries, instead dump the DMI data to a file in binary form. The generated file is suitable to pass to --from-dump later.

   --from-dump FILE
      Read the DMI data from a binary file previously generated using --dump-bin.

      Do not attempt to read DMI data from sysfs files. This is mainly useful for debugging.

   --oem-string N
      Only display the value of the OEM string number N. The first OEM string has number 1. With special value "count", return the number of OEM strings instead.

-h, --help
      Display usage information and exit

-V, --version
      Display the version and exit

Options --string, --type, --dump-bin and --oem-string determine the output format and are mutually exclusive.

dmidecode 命令 DMI 类型:

The SMBIOS specification defines the following DMI types:

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

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.

dmidecode 命令 Keyword-Type 对应速查表:

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

dmidecode 命令实例:

dmidecode 显示所有 DMI 表内容:

sudo dmidecode

dmidecode 显示BIOS版本:

sudo dmidecode -s bios-version

dmidecode 显示系统的序列号:

sudo dmidecode -s system-serial-number

dmidecode 显示BIOS信息:

sudo dmidecode -t bios

dmidecode 显示CPU信息:

sudo dmidecode -t processor
sudo dmidecode -t 4 # 4 -> CPU

dmidecode 显示内存信息:

sudo dmidecode -t memory

dmidecode 命令扩展阅读:

dmidecode 命令评论

共收录到 503Linux 命令