dmidecode---linux获取设备信息的命令

https://linux.die.net/man/8/dmidecode

  • 格式

dmidecode [OPTIONS]

  • 描述

dmidecode 用于dump 计算机的DMI表(有时候也叫SMBIOS)的内容,并以可读的方式呈现。这个DMI表中包含有“系统的硬件的组件信息”,和其它非常有价值的信息,例如,cpu序列号 和BIOS版本等等。幸亏有这么个表,我们可以不用探测实际的硬件就可以获取这些信息。虽然在性能上是好的,但是,这些信息可能不是可靠的啊。

DMI表不只描述当前系统的组成,还描述了可能的进化方案(例如,支持的最快的cpu 或者支持的最大内存)。

SMBIOS标识系统管理BIOS,DMI标识直接管理接口(Desktop Management Interface)。

运行dmidecode命令时,会定位到DMI表。如果成功,则会解析该表并以如下类似的方式来显示:

Handle 0x0002, DMI type 2, 8 bytes. Base Board Information Manufacturer: Intel
Product Name: C440GX+
Version: 727281-001
Serial Number: INCY92700942

每个记录会有:

  1. 一个handle。This is a unique identifier, which allows records to reference each other. For example, processor records usually reference cache memory records using their handles.
  2. 一个类型。The SMBIOS specification defines different types of elements a computer can be made of. In this example, the type is 2, which means that the record contains "Base Board Information".
  3. 一个size:Each record has a 4-byte header (2 for the handle, 1 for the type, 1 for the size), the rest is used by the record data. This value doesn't take text strings into account (these are placed at the end of the record), so the actual length of the record may be (and is often) greater than the displayed value.
  4. 很多解码的数值。 The information presented of course depends on the type of record. Here, we learn about the board's manufacturer, model, version and serial number.
  • 选项

-d, --dev-mem FILE  :

从设备文件中读取内存(默认是/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-manufacturer, system-product-name, system-version, system-serial-number, system-uuid, 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.
-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.
-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.
-h, --help
Display usage information and exit
-V, --version
Display the version and exit
Options --string, --type and --dump-bin determine the output format and are mutually exclusive.

  • Dmi 类型

The SMBIOS specification defines the following DMI types:
Type    Information
0
1    System
2    Base Board
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 Device
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.

 

  • 关键字可以用于替代type 数值 ,同样使用 --type 选项。每个关键字等价于相关的多个type 数值。如下所示

Keyword    Types
bios
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
Binary Dump File Format


The binary dump files generated by --dump-bin and read using --from-dump are formatted as follows:
The SMBIOS or DMI entry point is located at offset 0x00. It is crafted to hard-code the table address at offset 0x20.
The DMI table is located at offset 0x20.
 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值