dmidecode

一、什么是dmidecode

       从名称上看, 就是对DMI的解码。DMI即(Desktop Management Interface)。

      该工具就是用于解析 DMI 的表的,由于DMI表只是一堆的二进制文件,用这个工具可以解析出来,像BIOS的版本信息,内存信息等。

二、命令的使用

1、命令说明

     dmidecode是一种工具,用于以人类可理解的格式转储计算机的DMI表(有些人称之为SMBIOS)内容。该表包含系统硬件组件的描述,如以及其他有用的信息,如序列号和BIOS修订。有了这张表,你可以在不需要探测实际的硬件的情况下获取这些信息。

      DMI表不仅描述了当前系统的组成,它还透露有可能的改进,比如支持的最快CPU、或者最大内存等。

     SMBIOS表示系统管理BIOS, DMI表示桌面管理界面。这两个标准都是紧密相关的,均由DMTF(桌面管理任务组)开发。

      当运行dmidecode时,会先定位DMI表。首先尝试从sysfs中读取DMI表,如果sysfs访问失败,下一步尝试直接从内存中读取。如果dmidecode成功地定位了一个有效的DMI表,然后它将解析这个表并显示如下所示的记录列表:
       Handle 0x0002, DMI type 2, 8 bytes.  Base Board Information
               Manufacturer: Intel
               Product Name: C440GX+
               Version: 727281-001
               Serial Number: INCY92700942

解释下每个记录的意思:

•Handle 0x0002。这是一个唯一的标识符,它允许记录相互引用。例如,处理器记录通常使用它们的句柄引用高速缓存内存记录。

•DMI type 2。SMBIOS规范定义了可以组成计算机的不同类型的元素。本例中,型号为2,即记录中包含“Base Board Information”。

8 bytes。每个记录都有一个4字节的头(2个是句柄,1个是类型,1个是大小),其余的由记录数据使用。这个值不考虑文本字符串(这些都位于记录的末尾),因此记录的实际长度可能(并且经常)大于显示的值。

Base Board Information。所提供的信息取决于记录的类型。在此例中,为设备的制造商,型号,版本和序列号。

2、命令选项

OPTIONS
       -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, system-manufac‐
              turer, 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-ver‐
              sion, 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  sys‐
              tems.  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, base‐
              board, 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.

           --no-sysfs
              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运行在一个拥有新的SMBIOS规范的BIOS系统上,该工具还不支持该规范,它将在输出的最顶部打印出相关消息。因此输出数据不可靠。

3、DMI类型说明

DMI TYPES
       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.

       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
 

 

  • 0
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
`dmidecode` 是一个在 Linux 和类 Unix 系统中广泛使用的命令行工具,用于获取系统的基本硬件信息,特别是关于DMI (Desktop Management Interface) 的数据。DMIS(Desktop Management Interface Standard)是一种标准,提供了操作系统和管理软件访问计算机硬件配置信息的方法。 dmidecode 命令详解如下: 1. **命令格式**: ``` dmidecode [选项] [-t 类型编号] [设备编号] ``` 其中,`-t` 选项用于指定要查询的设备类型(例如 -t 1 代表系统信息,-t 2 代表主板信息等),设备编号可选,用于查询特定的设备。 2. **输出格式**: dmidecode 会返回一个 JSON 或 XML 格式的列表,列出了硬件的相关信息,包括制造商、产品名称、序列号、部件号、BIOS 版本等。 3. **常用选项**: - `-s` 或 `--string`:仅显示字符串值,不使用 XML 或 JSON 格式。 - `-H` 或 `--human-readable`:将数字值转换为人类可读的形式。 4. **主要类型**: - **Type 0**:系统信息,通常包含总体系统描述。 - **Type 1**:主板信息,如制造商、产品名等。 - **Type 2**:BIOS/UEFI 信息。 - **Type 3**:处理器信息。 - **Type 4**:内存信息。 - **Type 17**:电池信息。 - 更多类型的详细内容,如硬盘、网络接口等,可以根据需要查询。 5. **示例**: ``` dmidecode -t 1 ``` 这会显示系统的总体信息,而 ``` dmidecode -t 2 -s system-product-name ``` 则只获取主板的产品名称。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值