在Linux系统下,想要查看系统的硬件信息就可以使用dmidecode命令,在Windows中可以使用“DMIScope”软件(收费软件,笔者未使用过)来查看和修改BIOS。
midecode允许你在Linux系统下获取有关硬件方面的信息。dmidecode遵循SMBIOS/DMI标准,其输出的信息包括BIOS、系统、主板、处理器、内存、缓存等等。
DMI(Desktop Management Interface,DMI)就是帮助收集电脑系统信息的管理系统,DMI信息的收集必须在严格遵照SMBIOS规范的前提下进行。SMBIOS(System Management BIOS)是主板或系统制造者以标准格式显示产品管理信息所需遵循的统一规范。SMBIOS和DMI是由行业指导机构Desktop Management Task Force(DMTF)起草的开放性的技术标准,其中DMI设计适用于任何的平台和操作系统。
DMI充当了管理工具和系统层之间接口的角色。它建立了标准的可管理系统更加方便了电脑厂商和用户对系统的了解。DMI的主要组成部分是Management Information Format(MIF)数据库。这个数据库包括了所有有关电脑系统和配件的信息。通过DMI,用户可以获取序列号、电脑厂商、串口信息以及其它系统配件信息。
dmidecode的作用是将DMI数据库中的信息解码,以可读的文本方式显示。由于DMI信息可以人为修改,因此里面的信息不一定是系统准确的信息。
不带选项执行dmidecode通常会输出所有的硬件信息。dmidecode有个很有用的选项-t,可以指定类型输出相关信息。假如要获得处理器方面的信息,则可以执行:```
dmidecode -t processor
Usage: dmidecode [OPTIONS]
Options are:
-d:(default:/dev/mem)从设备文件读取信息,输出内容与不加参数标准输出相同。
-h:显示帮助信息。
-s:只显示指定DMI字符串的信息。(string)
-t:只显示指定条目的信息。(type)
-u:显示未解码的原始条目内容。
-- dump-bin FILE: Dump the DMI data to a binary file.
-- from-dump FILE: Read the DMI data from a binary file.
-V:显示版本信息
dmidecode的输出格式一般如下:
Handle 0x0002, DMI type 2, 95 bytes.
Base Board Information
Manufacturer: IBM
Product Name: Node1 Processor Card
Version: Not Specified
Serial Number: Not Specified
其中记录头(recode header)包括了:
recode id(Handle):DMI表中的记录标识符,这是唯一的,比如上例中的Handle 0x0002.
DMI type id:记录的类型,譬如说:BIOS,Memory,上例是type 2,即“Base Board Information”.
recode size:DMI表中对应记录的大小,上例为95 bytes。(不包括文本信息,所有实际输出的内容比这个size要更大)。记录头之后就是记录的值。
recoded values:记录值可以是多行的,比如上例显示了主板的制造商(Manufacturer)、Product Name、Version以及Serial Number。
1. 最简单的的显示全部dmi信息:
[root@BAIYU_180 ~]# dmidecode
[root@BAIYU_180 ~]# dmidecode|wc -l
6042
这样将输出所有的dmi信息,你可能会被一大堆的信息吓坏,通常可以使用下面的方法。
2.显示指定类型的信息:
通常我只想查看某类型,比如CPU,内存或者磁盘的信息而不是全部的。这可以使用-t(–type TYPE)来指定信息类型:
# dmidecode -t bios
# dmidecode -t bios, processor (这种方式好像不可以用,必须用下面的数字的方式)
# dmidecode -t 0,4 (显示bios和processor)
dmidecode到底支持哪些type?
这些可以在man dmidecode里面看到:
文本参数支持:
bios, system, baseboard, chassis, processor, memory, cache, connector, slot
数字参数支持很多:(见附录)
4.通过关键字查看信息:
比如只想查看序列号,可以使用:
# dmidecode -s system-serial-number
-s (–string keyword)支持的keyword包括:
bios-vendor,bios-version,bios-release-date,
system-manufacturer,system-product-name,system-version,system-serial-number,
baseboard-manu-facturer,baseboard-product-name,baseboard-version,baseboard-serial-number,baseboard-asset-tag,
chassis-manufacturer,chas-sis-version,chassis-serial-number,chassis-asset-tag,
processor-manufacturer,processor-version.
附录:
SMBIOS specification 2.7.1 中定义了如下的结构类型:
Type | Description |
---|---|
0 | BIOS Information |
1 | System Information |
2 | Baseboard (or Module) Information |
3 | System Enclosure or Chassis |
4 | Processor Information |
5 | Memory Controller Information (Obsolete) |
6 | Memory Module Information (Obsolete) |
7 | Cache Information |
8 | Port Connector Information |
9 | System Slots |
10 | On Board Devices Information |
11 | OEM Strings |
12 | System Configuration Options |
13 | BIOS Language Information |
14 | Group Associations |
15 | System Event Log |
16 | Physical Memory Array |
17 | Memory Device |
18 | 32-Bit Memory Error Information |
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 (BIS) Entry Point |
32 | System Boot Information |
33 | 64-Bit Memory Error Information |
34 | Management Device |
35 | Management Device Component |
36 | Management Device Threshold Data |
37 | Memory Channel |
38 | IPMI Device Information |
39 | System Power Supply |
40 | Additional Information |
41 | Onboard Devices Extended Information |
42 | Management Controller Host Interface |
126 | Inactive |
127 | End-of-Table |
128-255 | Available for system- and OEM- specific information |
参考:
https://www.linuxidc.com/Linux/2015-12/126814.htm