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.
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
If not installed, below is the command to install the dmidecode tool for Debian/Ubuntu.
sudo apt install dmidecode
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:
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 |
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.
Keywords | 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 |
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
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
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
To get the hardware details for the system, use the below command.
sudo dmidecode -t system
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.
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
Another example is getting the chassis version. Use the following command.
sudo dmidecode -s chassis-type
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.
Comments