20 dmidecode command examples in Linux [Cheat Sheet]


CheatSheet

Reviewer: Deepak Prasad

Introduction

dmidecode is a command-line utility in Unix and Unix-like operating systems, including Linux. It is used to retrieve and decode the DMI (Desktop Management Interface) data from the DMI table. DMI is a standard framework intended for managing and tracking hardware components in a system. Most modern systems have a DMI table that provides information about the system's hardware components such as the BIOS, system, motherboard, processor, memory, and more.

Typical use cases for dmidecode command:

  • Fetching BIOS Information: Retrieving details like the BIOS version, vendor, and release date.
  • Identifying System Manufacturer and Model: If you want to know the exact model of a system (useful for driver downloads or replacement parts), dmidecode can provide this.
  • Checking Memory Configuration: You can use dmidecode to check how many memory slots your system has, which slots are occupied, the size of each memory module, and even details like memory speed and type.
  • Processor Details: Retrieve specifics about the system's processor(s), such as speed, cores, threads, and manufacturer.
  • Asset Management: By scripting around dmidecode, one can gather a complete inventory of systems, useful in large IT setups for managing assets.
  • Hardware Auditing: For scenarios where one needs to verify that a machine meets specific hardware requirements or specifications.
  • Documentation: Keeping system configuration documents up-to-date with the actual hardware setup.

 

Understanding Desktop Management Interface (DMI)

DMI is a framework that manages, maintains, and tracks hardware components in a system. It provides a standardized structure for system information, enabling administrators and software to query and set hardware-related settings. DMI operates at the component level, meaning that it's mainly focused on individual parts of a system, such as the BIOS, motherboard, memory, and other pieces of hardware.

Important DMI Types

The DMI type identifies the type of data a particular DMI table entry represents. Here's a list of some key DMI types:

  • Type 0: BIOS
    • Information about the system's BIOS.
  • Type 1: System
    • General information about the system like manufacturer, product name, version, etc.
  • Type 2: Base Board (or Module)
    • Information about the system's main circuit board, like its manufacturer, version, and serial number.
  • Type 3: Chassis
    • Details about the system's chassis, including type (e.g., desktop, tower), manufacturer, and security status.
  • Type 4: Processor
    • Information about the CPU(s) installed on the system.
  • Type 5: Memory Controller
    • Details about the system's memory controller.
  • Type 6: Memory Module
    • Information about the memory modules installed on the system.
  • Type 7: Cache
    • Information about the cache memory of the system.

And so on. There are many DMI types (going up to type 44 as of my last update), each describing a different aspect or component of the system.

 

Basic usage of dmidecode command

You will need root privileges to execute the dmidecode command. The general syntax of dmidecode command is:

$ sudo dmidecode [option]

If dmidecode command is successfully executed, it prints the following details in the output.

  • Handle: It is a unique identifier that allows records to reference each other.
  • Type: It provides information about computer elements such as system, baseboard, chassis, processor, etc. A number value denotes each element. For example, if the type is 0, it means that the record contains BIOS information.
  • Size: It shows the size of each record. Each record contains a 4-byte header (2 for the handle, 1 for the type, 1 for the size). The record data uses the rest.
  • Decoded values: It contains the information depending on the type of record. The BIOS information includes details of the vendor, version, release date, ROM size, etc.

Sample Output:

dmidecode command

DMI Types

The following are DMI types and their respective information.

       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
...
         29   Electrical Current Probe
         30   Out-of-band Remote Access31   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

In this article, we will learn how to use dmidecode command to get information about hardware components in Linux systems.

 

1. Read memory from alternate device file

The --dev-mem option in dmidecode allows you to specify an alternate device file for accessing the system's physical memory.

By default, dmidecode reads the system's DMI (SMBIOS) information directly from the system's physical memory, using the /dev/mem device file. The /dev/mem file represents the system's physical memory, and with appropriate permissions, you can directly access and read from it.

The --dev-mem option lets you override the default /dev/mem path. This could be useful in specialized environments or scenarios where the default memory device is located somewhere other than /dev/mem or when analyzing a memory dump from another machine.

$ sudo dmidecode -d FILE

OR

$ sudo dmidecode --dev-mem FILE

Sample Output:

dmidecode command to read memory from file

 

2. List available DMI 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.

You can just hit dmidecode --type without any TYPE and it should give you the list of supported TYPEs

# dmidecode --type
dmidecode: option '--type' requires an argument
Type number or keyword expected
Valid type keywords are:
  bios
  system
  baseboard
  chassis
  processor
  memory
  cache
  connector
  slot

 

3. Mapping DMI Type with Type ID

You can check the man page of dmidecode command to get the mapping ID of individual DMI Type. Here is a sample output:

       Keyword     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

Going forward we can either use the keyword or the Type ID with dmidecode --type [KEYWORD|ID] to get more information for the respective component.

 

4. Display the information using Type ID

In the previous section we got the TYPE ID of individual supported TYPEs. You can use -t or --type option with the type ID to get more information for that component. It displays the information of specified DMI type. If type ID is not provided or not valid, it prints the list of valid keywords and exits with an error.

$ sudo dmidecode -t type_ID

OR

$ sudo dmidecode --type type_ID

For Example, to get information about the system cassis we will use Type ID as 3:

Sample Output:

dmidecode command to display chassis information

 

5. Display system information using TYPE Keyword

In the previous section we used TYPE ID with dmidecode command, you can also use keywords instead of type ID.

$ sudo dmidecode -t keyword

Sample Output:

# dmidecode --type=memory
# dmidecode 3.2
Getting SMBIOS data from sysfs.
SMBIOS 2.8 present.

Handle 0x1000, DMI type 16, 23 bytes
Physical Memory Array
	Location: Other
	Use: System Memory
	Error Correction Type: Multi-bit ECC
	Maximum Capacity: 60 GB
	Error Information Handle: Not Provided
	Number Of Devices: 4

Handle 0x1100, DMI type 17, 40 bytes
Memory Device
	Array Handle: 0x1000
	Error Information Handle: Not Provided
	Total Width: Unknown
	Data Width: Unknown
	Size: 16384 MB
	Form Factor: DIMM
	Set: None
	Locator: DIMM 0
	Bank Locator: Not Specified
	Type: RAM
	Type Detail: Other
	Speed: Unknown
	Manufacturer: Red Hat
	Serial Number: Not Specified
	Asset Tag: Not Specified
	Part Number: Not Specified
	Rank: Unknown
	Configured Memory Speed: Unknown
	Minimum Voltage: Unknown
	Maximum Voltage: Unknown
	Configured Voltage: Unknown
...

 

6. Display the information about BIOS

The following command displays the BIOS information of your system.

$ sudo dmidecode -t bios

OR

$ sudo dmidecode --type bios

Sample Output:

dmidecode command to display bios information

 

7. Print the system information

You can use this command to get information about the system's manufacturer, product name, version, and serial number.

$ sudo dmidecode -t system

OR

$ sudo dmidecode --type system

Sample Output:

dmidecode command to display system information

 

8. Display the baseboard information

With the following command, you can get the baseboard information of the system.

$ sudo dmidecode -t baseboard

OR

$ sudo dmidecode --type baseboard

Sample Output:

dmidecode command to display baseboard information

 

9. Get the information about chassis

To get the information about chassis, you can run the following command.

$ sudo dmidecode -t chassis

Sample Output:

dmidecode command to display chassis information

 

10. Display the information using DMI string keywords

You can use -s or --string option to display the information using DMI string keywords. If keyword is not provided or not valid, it prints the list of valid keywords and exits with an error.

Following are the valid string keywords:

  bios-vendor
  bios-version
  bios-release-date
  system-manufacturer
  system-product-name
  system-version
  system-serial-number
  system-uuid
  system-family
  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
$ sudo dmidecode -s KEYWORD

OR

$ sudo dmidecode --string KEYWORD

Sample Output:

dmidecode string keyword command

 

11. Get BIOS version

We can utilise the bios-version string using dmidecode --string bios-version to get the BIOS version of any Linux system:

# dmidecode --string bios-version
1.11.0-2.el7

 

12. Get BIOS Release Date

We can utilise the bios-release-date string using dmidecode --string bios-release-date command to get the BIOS release date of any Linux server:

# dmidecode --string bios-release-date
04/01/2014

# dmidecode --string bios-release-date
05/21/2018

 

13. Get System Product Name of Linux Hardware

We can utilise the system-product-name string and can be used as dmidecode --string system-product-name to get the product name on which the Linux server is installed:

# dmidecode --string system-product-name
ProLiant BL460c Gen9


# dmidecode --string system-product-name
OpenStack Compute

 

14. Get serial number of your Linux hardware

We can utilise the system-serial-number string and can be used as dmidecode --string system-serial-number to get the serial number of the hardware on which Linux server is installed:

# dmidecode --string system-serial-number
SGH709S309

# dmidecode --string system-serial-number
5f7dfa83-de5a-43a4-a8c1-87be1d4a92a8

 

15. Get processor information of your Linux hardware

You can utilise the processor-version to get the details of the processor available on your Linux server. If your server is having more than one processor then the following command may result in more than one result:

# dmidecode --string processor-version
Intel(R) Xeon(R) CPU E5-2640 v3 @ 2.60GHz
Intel(R) Xeon(R) CPU E5-2640 v3 @ 2.60GHz

# dmidecode --string processor-version
RHEL 7.6.0 PC (i440FX + PIIX, 1996)
RHEL 7.6.0 PC (i440FX + PIIX, 1996)

 

16. Get processor frequency of your processor

We can also get the processor frequency of the processor used in your Linux server using the following command. Here also if you have more than one processor then you may get multiple result for individual processor:

# dmidecode --string processor-frequency
2000 MHz
2000 MHz

# dmidecode --string processor-frequency
2600 MHz
2600 MHz

 

17. Provide less verbose output

Using -q or --quiet option hides some information in the output. Unknown, inactive, and OEM -specific entries are hidden. It also does not display meta-data and handle references.

$ sudo dmidecode -q 

OR

$ sudo dmidecode --quiet

Sample Output:

dmidecode command to hide some information

 

18. Dump the information as hexadecimal

-u or --dump option does not decode the table contents but dumps the contents as hexadecimal instead. The string values of each entry are displayed as both hexadecimal and ASCII. It can be helpful in debugging.

$ sudo dmidecode -u

OR

$ sudo dmidecode --dump 

Sample Output:

dmidecode command to dump the contents

 

19. Dump the DMI data to a file

You can use this command to dump the DMI data into a file in a binary form.

$ sudo dmidecode --dump-bin filename

Sample Output:

dmidecode command to dump contents in file

 

20. Read the data from a binary file

To read the data from a binary file previously generated with --dump-bin, you can use the following command.

$ sudo dmidecode --from-dump filename

Sample Output:

dmidecode command to read from dump file

 

Alternatives to dmidecode command

While dmidecode is a prevalent tool for fetching DMI (SMBIOS) information, several other utilities offer similar or complementary functionalities:

  • lshw: A comprehensive tool that provides detailed reports about all hardware components in the system.
  • hwinfo: Another tool that probes for available hardware in the system and provides detailed information about them.
  • inxi: A full-featured system information script that provides an overview of system hardware, software, and system status.
  • lscpu: Focuses specifically on CPU architecture. It provides detailed information about the CPU.
  • lsblk: Lists information about block devices (like drives) on the system.
  • lsusb: Shows information about USB buses and connected USB devices.
  • lspci: Displays information about all PCI buses and devices in the system.
  • biosdecode: Decodes several different types of BIOS data. It's from the same suite as dmidecode.

 

Conclusion

dmidecode stands as an essential tool in the toolkit of system administrators, IT professionals, and hardware enthusiasts. Its ability to directly retrieve and decode DMI/SMBIOS information without relying on the OS's current knowledge of the hardware makes it uniquely positioned to provide accurate and detailed insights about the system's hardware components. While there are alternatives and complementary tools, the specificity and comprehensive nature of the data dmidecode offers make it irreplaceable for certain tasks. Understanding your system down to the component level can be invaluable for troubleshooting, audits, optimizations, or mere curiosity.

 

What's Next

5 system tools to monitor network traffic in Linux with examples

 

Further Reading

man page for dmidecode command

 

Rohan Timalsina

Rohan Timalsina

He is proficient in a wide range of skills, including Page Builder Plugins such as Elementor, Beaver Builder, Visual Composer, and Divi Builder. His expertise extends to Front End Development with HTML5/CSS3, JavaScript, Bootstrap, and React.js. You can connect with him on his LinkedIn profile.

Can't find what you're searching for? Let us assist you.

Enter your query below, and we'll provide instant results tailored to your needs.

If my articles on GoLinuxCloud has helped you, kindly consider buying me a coffee as a token of appreciation.

Buy GoLinuxCloud a Coffee

For any other feedbacks or questions you can send mail to admin@golinuxcloud.com

Thank You for your support!!

Leave a Comment