dmidecode命令 可以让你在Linux系统下获取有关硬件方面的信息。dmidecode的作用是将DMI数据库中的信息解码,以可读的文本方式显示。由于DMI信息可以人为修改,因此里面的信息不一定是系统准确的信息。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 [OPTIONS]
[root@test ~]# dmidecode --help
Usage: dmidecode [OPTIONS]
Options are:
-d, --dev-mem FILE Read memory from device FILE (default: /dev/mem)
-h, --help Display this help text and exit
-q, --quiet Less verbose output
-s, --string KEYWORD Only display the value of the given DMI string
-t, --type TYPE Only display the entries of given type
-H, --handle HANDLE Only display the entry of given handle
-u, --dump Do not decode the entries
–dump-bin FILE Dump the DMI data to a binary file
–from-dump FILE Read the DMI data from a binary file
–no-sysfs Do not attempt to read DMI data from sysfs files
–oem-string N Only display the value of the given OEM string
-V, --version Display the version and exit
-d:(default:/dev/mem)从设备文件读取信息,输出内容与不加参数标准输出相同。
-h:显示帮助信息。
-q:概要输出
-s:只显示指定DMI字符串的信息。(string)
-t:只显示指定条目的信息。(type)
-H:仅显示给定句柄的条目
-u:显示未解码的原始条目内容。
–dump-bin file:将DMI数据转储到一个二进制文件中。
–from-dump FILE:从一个二进制文件读取DMI数据。
–no sysfs:不尝试从sysfs文件读取DMI数据
–oem-string N:仅显示给定oem字符串的值
-V:显示版本信息。
[root@test ~]# dmidecode -t 2
# dmidecode 3.1
Getting SMBIOS data from sysfs.
SMBIOS 2.7 present.
Handle 0x0002, DMI type 2, 15 bytes
Base Board Information
Manufacturer: Dell Inc. #厂商
Product Name: 0VHWTR #产品型号
Version: A02 #版本
Serial Number: /6S5LW02/CN7016343J07GD/ #主板序列号
Asset Tag: Not Specified
Features:
Board is a hosting board
Board is replaceable
Location In Chassis: Not Specified
Chassis Handle: 0x0003
Type: Motherboard
Contained Object Handles: 0
可以看到数量为2条,支持的最大内存为16G。
[root@test ~]# dmidecode -t 16
# dmidecode 3.1
Getting SMBIOS data from sysfs.
SMBIOS 2.7 present.
Handle 0x0037, DMI type 16, 23 bytes
Physical Memory Array
Location: System Board Or Motherboard
Use: System Memory
Error Correction Type: None
Maximum Capacity: 16 GB
Error Information Handle: Not Provided
Number Of Devices: 2
[root@test ~]# dmidecode|grep -P -A5 “Memory Device” |grep Size
Size: 4096 MB
Size: 4096 MB
Range Size: 4 GB
Range Size: 4 GB
可以查看内存的详细信息,可以看到内存型号为DDR3,一共2条内存,每天4G,速率为1600Mt/s,还可以看到内存的序列号。
[root@test ~]# dmidecode -t 17
# dmidecode 3.1
Getting SMBIOS data from sysfs.
SMBIOS 2.7 present.
Handle 0x0038, DMI type 17, 34 bytes
Memory Device
Array Handle: 0x0037
Error Information Handle: Not Provided
Total Width: 64 bits
Data Width: 64 bits
Size: 4096 MB
Form Factor: DIMM
Set: None
Locator: DIMM1
Bank Locator: Not Specified
Type: DDR3
Type Detail: Synchronous
Speed: 1600 MT/s
Manufacturer: Samsung
Serial Number: 0BB0C40DE094
Asset Tag: 9876543210
Part Number: M378B5173DB0-CK0
Rank: 1
Configured Clock Speed: 1600 MT/s
Handle 0x003A, DMI type 17, 34 bytes
Memory Device
Array Handle: 0x0037
Error Information Handle: Not Provided
Total Width: 64 bits
Data Width: 64 bits
Size: 4096 MB
Form Factor: DIMM
Set: None
Locator: DIMM2
Bank Locator: Not Specified
Type: DDR3
Type Detail: Synchronous
Speed: 1600 MT/s
Manufacturer: Samsung
Serial Number: 0A903706C0F1
Asset Tag: 9876543210
Part Number: M378B5173DB0-CK0
Rank: 1
Configured Clock Speed: 1600 MT/s
可以看到是intel的酷睿i3处理器,处理速度3400MHz。
[root@test ~]# dmidecode -t 4
# dmidecode 3.1
Getting SMBIOS data from sysfs.
SMBIOS 2.7 present.
Handle 0x0033, DMI type 4, 42 bytes
Processor Information
Socket Designation: SOCKET 0
Type: Central Processor
Family: Core i3
Manufacturer: Intel
ID: C3 06 03 00 FF FB EB BF
Signature: Type 0, Family 6, Model 60, Stepping 3
Flags:
FPU (Floating-point unit on-chip)
VME (Virtual mode extension)
DE (Debugging extension)
PSE (Page size extension)
TSC (Time stamp counter)
MSR (Model specific registers)
PAE (Physical address extension)
MCE (Machine check exception)
CX8 (CMPXCHG8 instruction supported)
APIC (On-chip APIC hardware supported)
SEP (Fast system call)
MTRR (Memory type range registers)
PGE (Page global enable)
MCA (Machine check architecture)
CMOV (Conditional move instruction supported)
PAT (Page attribute table)
PSE-36 (36-bit page size extension)
CLFSH (CLFLUSH instruction supported)
DS (Debug store)
ACPI (ACPI supported)
MMX (MMX technology supported)
FXSR (FXSAVE and FXSTOR instructions supported)
SSE (Streaming SIMD extensions)
SSE2 (Streaming SIMD extensions 2)
SS (Self-snoop)
HTT (Multi-threading)
TM (Thermal monitor supported)
PBE (Pending break enabled)
Version: Intel® Core™ i3-4130 CPU @ 3.40GHz
Voltage: 1.2 V
External Clock: 100 MHz
Max Speed: 3800 MHz
Current Speed: 3400 MHz
Status: Populated, Enabled
Upgrade: Socket BGA1155
L1 Cache Handle: 0x0034
L2 Cache Handle: 0x0035
L3 Cache Handle: 0x0036
Serial Number: Not Specified
Asset Tag: Fill By OEM
Part Number: Fill By OEM
Core Count: 2
Core Enabled: 2
Thread Count: 4
Characteristics:
64-bit capable
[root@test ~]# dmidecode|grep -A16 “Memory Device”|grep ‘Speed’
Speed: 1600 MT/s
Speed: 1600 MT/s
[root@test ~]# dmidecode|grep -P ‘Maximum\s+Capacity’
Maximum Capacity: 16 GB
[root@test ~]# dmidecode -t bios
# dmidecode 3.1
Getting SMBIOS data from sysfs.
SMBIOS 2.7 present.
Handle 0x0000, DMI type 0, 24 bytes
BIOS Information
Vendor: Dell Inc.
Version: A02
Release Date: 01/07/2014
Address: 0xF0000
Runtime Size: 64 kB
ROM Size: 8192 kB
Characteristics:
PCI is supported
PNP 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
Function key-initiated network boot is supported
Targeted content distribution is supported
UEFI is supported
BIOS Revision: 4.6
Handle 0xDEDC, DMI type 13, 22 bytes
BIOS Language Information
Language Description Format: Long
Installable Languages: 1
en|US|iso8859-1
Currently Installed Language: en|US|iso8859-1
[root@test ~]# dmidecode -s bios-version
A02