Dmidecode in Linux

Written by: Bobbin Zachariah   |   Last updated: October 26, 2022

The dmidecode in Linux stands for Desktop Management Interface, abbreviated as DMI. The dmidecode is a Linux command that comes in handy in retrieving all details of your system’s hardware components, and it displays the output in a human-readable format. You can utilize the DMI on various Linux systems, including Debian, CentOS/RHEL, OpenSUSE, Fedora, and Arch Linux.

This guide dives into all details about using the dmidecode command in Linux, including the installation and examples of using the tool.

What is the purpose of dmidecode

Keeping a tab on the system’s hardware components is part of a Linux administrator job, and with a command like DMI, you can easily fetch the system’s details from the DMI table. It gets better since dmidecode will give the output in a human-readable format, and you can view all the details, such as BIOS, CPU details, serial numbers, etc.

Moreover, with DMI, you can get other crucial information, such as the supported memory or CPU by a given system. That way, you get to make informed decisions. The dmidecode mainly achieves a faster and cleaner way of analyzing the hardware components of a given system.

The best part about the dmidecode is that it lists the DMI table details in a record containing four main components. The components represent the syntax as retrieved in the DMI table.

The first is the handle. It is the unique identifier that allows referencing of records for identification. The second is the type, representing the various elements the particular computer can be composed of.

The third is the size which represents the length of each record. Lastly, the decoded values are the details of the particular record type.

For instance, the image below represents a dmidecode output sample.

dmidecode output

In the above dmidecode command output, we can note the first component is the handle. For this case, the handle 0x0001. Next, we have the type of DMI as type 4. Further, we have the record size as 42 bytes; below it is the decoded values for our DMI type 4 which later we will note that type 4, according to the SMBIOS specification, represents the processor.

You can confirm so by noting the processor type. In this case, it’s highlighted as core i5.

Installing Dmidecode on Linux

Now that we understand what dmidecode means on Linux and how handy it comes, how about knowing how to install it on your system?

Debian / Ubuntu

You should find the dmidecode as a built-in tool for Ubuntu, especially for later versions. You can confirm so by checking its version using the below command.

dmidecode --version
check dmidecode version

If not installed, below is the command to install the dmidecode tool for Debian/Ubuntu.

sudo apt install dmidecode
dmidecode ubuntu linux install

You can note above that dmidecode is set to install in updated Ubuntu/Debian systems manually.

Fedora

To install the dmidecode on Fedora, use the command below.

sudo dnf install dmidecode

Arch Linux

For Arch, use the pacman command to install dmidecode with the below command.

sudo pacman -S dmidecode

That’s it. You now have dmidecode installed on your Linux system. Let’s move on to how to use and read the DMI table records.

DMI Table in Linux

So far, we’ve installed the dmidecode. The next thing is to use it to retrieve hardware component details. When using the dmidecode command, you must know the various DMI types and what they mean.

The dmidecode allows you to use the type name or the type ID of the information you want to retrieve about your hardware components. Check the below dmi table to know the DMI type number representing a given DMI type:

TypeInformation
0BIOS
1System
2Baseboard
3Chassis
4Processor
5Memory Controller
6Memory Module
7Cache
8Port Connector
9System Slots
10On Board Devices
11OEM Strings
12System Configuration Options
13BIOS Language
14Group Associations
15System Event Log
16Physical Memory Array
17Memory Device
1832-bit Memory Error
19Memory Array Mapped Address
20Memory Device Mapped Address
21Built-In Pointing Device
22Portable Battery
23System Reset
24Hardware Security
25System Power Controls
26Voltage Probe
27Cooling Device
28Temperature Probe
29Electrical Current Probe
30Out-of-band Remote Access
31Boot Integrity Services
32System Boot
3364-bit Memory Error
34Management Device
35Management Device Component
36Management Device Threshold Data
37Memory Channel
38IPMI Device
39Power Supply
40Additional Information
41Onboard Devices Extended Information
42Management Controller Host Interface

Instead of using the “type id” option for getting the hardware component data, we can use keywords that match specific keyword types. Besides, the keywords act as a shorthand for achieving the same. Take a look at the below table.

KeywordsTypes
bios0, 13
system1, 12, 15, 23, 32
baseboard2, 10, 41
chassis3
processor4
memory5, 6, 16, 17
cache7
connector8
slot9

Read on to find out how we use keywords using the -t option.

DMIdecode Examples

Using the DMI table displaying the DMI types, we can see the various options for using dmidecode. Take a look!

Get hardware information

Run the below command to display all the system’s hardware information without specifying the DMI type.

sudo dmidecode
showing hardware information using dmidecode

You can scroll down the output checking the various output until you get to the last DMI type at the bottom.

Using DMI Type to Get Hardware Information

dmidecode command lets you filter the output using the DMI type keyword or ID.

For instance, to get the bios information, including the bios version and bios release date, you can use the keyword “bios.” Note that we are using the t option to stand for type. Refer to the man page for dmidecode for more options for the command.

sudo dmidecode --type bios

or

sudo dmidecode -t bios
dmidecode bios info

To get the Cache information, you can use its keyword or the type id for the keyword, which is 7. Either of the below commands will work.

sudo dmidecode -t 7

or

sudo dmidecode -t cache
dmidecode showing cache

To get the hardware details for the system, use the below command.

sudo dmidecode -t system
dmidecode showing system information

For the details about the DIMMs and the physical memory device, you can use ID 17 to extract them.

sudo dmidecode -t 17

Below is our memory information retrieved from the DMI data.

dmidecode get memory information

The process is the same to get the hardware components of any DMI type. Refer to the table to use the associated keyword or its type ID, which also gives the same result.

The most important factor is knowing which information you want to retrieve and its corresponding keyword type or ID.

You can also combine the type option with other options to display different outputs. For instance, if you prefer dmidecode output in a hexadecimal format, use the --dump or -u option.

Let’s display the system components in a hexadecimal format using the below command.

sudo dmidecode --dump -t system

or

sudo dmidecode -u -t system

Using DMI String Keywords

The --string or -s options help display the DMI details using string keywords, which is helpful when you want to extract a given detail in the information extracted for a given DMI type. Common string keywords include bios release date, serial number, system information, bank locator, memory array mapped address, memory speed, etc.

Let’s have some examples of how to use it.

To get the system manufacturer name, we can use the string keyword “system-manufacturer,” as in the example below.

sudo dmidecode -s system-manufacturer
dmidecode get system manufacturer information

Another example is getting the chassis version. Use the following command.

sudo dmidecode -s chassis-type
dmidecode get chassis information

Conclusion

For me, a few times it came as a handy command to check memory and serial number. Feel free to contribute, the source code is available on GitHub.

Let us know how it helped you to retrieve system information in the comment section.

About The Author

Bobbin Zachariah

Bobbin Zachariah

Bobbin Zachariah is an experienced Linux engineer who has been supporting infrastructure for many companies. He specializes in Shell scripting, AWS Cloud, JavaScript, and Nodejs. He has qualified Master's degree in computer science. He holds Red Hat Certified Engineer (RHCE) certification.

SHARE

Comments

Please add comments below to provide the author your ideas, appreciation and feedback.

Leave a Reply

Leave a Comment