How to use the command dmidecode (with examples)
- Linux
- December 25, 2023
dmidecode is a command-line tool used to display the DMI (Desktop Management Interface) or SMBIOS (System Management BIOS) table contents in a human-readable format. It is typically used to retrieve hardware-related information from a computer system. The command requires root privileges and can provide various details such as BIOS version, system serial number, BIOS information, CPU information, and memory information.
Use case 1: Show all DMI table contents
Code:
sudo dmidecode
Motivation:
This use case is useful when you want to gather comprehensive information about the hardware installed on a system. It provides a detailed report containing information about the system’s BIOS, CPU, memory, and other components.
Explanation:
The sudo
command is used to execute dmidecode with root privileges. The dmidecode
command retrieves and displays the entire DMI table contents in a readable format.
Example output:
# dmidecode 3.2
Getting SMBIOS data from sysfs.
SMBIOS 3.4.0 present.
Handle 0x0000, DMI type 0, 26 bytes
BIOS Information
Vendor: Dell Inc.
Version: 1.2.3
Release Date: 01/01/2022
BIOS Revision: 1.5
Firmware Revision: 1.7
Handle 0x0001, DMI type 1, 27 bytes
System Information
Manufacturer: Dell Inc.
Product Name: Inspiron 1234
Version: 1.0.0
Serial Number: ABCD1234
UUID: 01234567-89AB-CDEF-0123-456789ABCDEF
Wake-up Type: Power Switch
SKU Number: 0123456789
Family: Inspiron
...
Use case 2: Show the BIOS version
Code:
sudo dmidecode -s bios-version
Motivation:
This use case is helpful when you only need to retrieve the BIOS version information from a system. It provides a quick way to obtain this specific detail.
Explanation:
The sudo
command is used to execute dmidecode with root privileges. The -s
option is used to specify that we want to display a specific string value. In this case, we are requesting the BIOS version. The argument bios-version
denotes the specific string we are interested in.
Example output:
1.2.3
Use case 3: Show the system’s serial number
Code:
sudo dmidecode -s system-serial-number
Motivation:
When you need to identify a specific system by its serial number, this use case comes in handy. It allows you to quickly retrieve the system’s unique identifier.
Explanation:
The sudo
command is used to execute dmidecode with root privileges. The -s
option is used to specify that we want to display a specific string value. In this case, we are requesting the system’s serial number. The argument system-serial-number
denotes the specific string we are interested in.
Example output:
ABCD1234
Use case 4: Show BIOS information
Code:
sudo dmidecode -t bios
Motivation:
When you require detailed information about the system’s BIOS, this use case is useful. It provides specific information related to the BIOS, such as the vendor, version, release date, and firmware revision.
Explanation:
The sudo
command is used to execute dmidecode with root privileges. The -t
option is used to specify the type of information we want to retrieve. In this case, we are requesting information related to the BIOS. The argument bios
denotes the specific type we are interested in.
Example output:
BIOS Information
Vendor: Dell Inc.
Version: 1.2.3
Release Date: 01/01/2022
BIOS Revision: 1.5
Firmware Revision: 1.7
Use case 5: Show CPU information
Code:
sudo dmidecode -t processor
Motivation:
When you need to gather detailed information about the CPU installed on a system, this use case is valuable. It provides specific information related to the CPU, such as the socket designation, manufacturer, and version.
Explanation:
The sudo
command is used to execute dmidecode with root privileges. The -t
option is used to specify the type of information we want to retrieve. In this case, we are requesting information related to the processor (CPU). The argument processor
denotes the specific type we are interested in.
Example output:
Processor Information
Socket Designation: CPU Socket
Type: Central Processor
Family: Core i7
Manufacturer: Intel
Version: Intel(R) Core(TM) i7-9700K CPU @ 3.60GHz
Max Speed: 3600 MHz
...
Use case 6: Show memory information
Code:
sudo dmidecode -t memory
Motivation:
When you want to obtain information about the memory (RAM) installed on a system, this use case is valuable. It provides specific details about the memory modules, such as the type, size, and speed.
Explanation:
The sudo
command is used to execute dmidecode with root privileges. The -t
option is used to specify the type of information we want to retrieve. In this case, we are requesting information related to memory. The argument memory
denotes the specific type we are interested in.
Example output:
Memory Device
Array Handle: 0x0001
Error Information Handle: Not Provided
Total Width: 64 bits
Data Width: 64 bits
Size: 16 GB
Form Factor: Unknown
...
Conclusion
dmidecode is a powerful command-line tool that allows you to retrieve hardware-related information from a system’s DMI or SMBIOS table. By using various options and arguments, you can obtain specific details about the BIOS, CPU, memory, and more. With the examples provided, you can utilize dmidecode to gather valuable information for troubleshooting, system audits, or general hardware knowledge.