20 dmidecode command examples in Linux [Cheat Sheet]

Introduction to dmidecode command

dmidecode is a tool that reads the data from the DMI table and prints it in a human-readable format. dmidecode is also called Desktop Management Interface table decoder. The DMI table contains details of the system's hardware components such as serial numbers, BIOS version, memory, processor, etc. You can use dmidecode command in any Linux system like Ubuntu, Linux Mint, Debian, RHEL, CentOS, and Fedora.

 

Different examples to use dmidecode command

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

Advertisement
$ 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
         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 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 device file using dmidecode command

-d or --dev-mem option is used to read memory from the device file. The default file is /dev/mem.

Advertisement
$ sudo dmidecode -d FILE

OR

$ sudo dmidecode --dev-mem FILE

Sample Output:

dmidecode command to read memory from file

 

2. List available TYPE with dmidecode command

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 with dmidecode command

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

Advertisement
$ 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 with dmidecode command

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 with dmidecode command

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. dmidecode command to 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 dmidecode command

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. dmidecode command to 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. dmidecode command to 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 using dmidecode command

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 using dmidecode command

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 with dmidecode command

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 using dmidecode command

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 with dmidecode command

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 using dmidecode command

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. Hide some information in dmidecode command 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 with dmidecode command

-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 with dmidecode command

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 using dmidecode command

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

 

Conclusion

This article presents the practical examples of dmidecode command in a Linux system. It is a useful tool to get the system's hardware information. If you still have any confusion, please let us know in the comment section.

 

What's Next

5 system tools to monitor network traffic in Linux with examples

 

Further Reading

man page for dmidecode command

 

Didn't find what you were looking for? Perform a quick search across GoLinuxCloud

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 either use the comments section or contact me form.

Thank You for your support!!

Leave a Comment