I've just started working on the Linux Commands section of Unix Tutorial, and dmidecode is one of the best commands to mention when it comes to recent Linux distros. It's found in most distributions and helps with learning lots of useful facts about your environments – both physical and virtual.
How To Use dmidecode Command
dmidecode command needs to be run as root and shows you hardware information about your system:
- BIOS name and version
- manufacturer of your server, desktop or laptop
- model name and serial number of your system
[email protected]:~ $ sudo dmidecode | less # dmidecode 3.2 Getting SMBIOS data from sysfs. SMBIOS 3.2.1 present. # SMBIOS implementations newer than version 3.2.0 are not # fully supported by this version of dmidecode. Table at 0x000E0000. Handle 0x0000, DMI type 0, 26 bytes BIOS Information Vendor: Dell Inc. Version: 1.2.1 Release Date: 02/14/2019 Address: 0xF0000 Runtime Size: 64 kB ROM Size: 32 MB ...
Browsing dmidecode output and searching through the output are the best ways to use dmidecode command, but once you become familiar with your environment you'll probably get a few dmidecode parameters you can grep for.
Hardware Vendor with dmidecode
This will report the manufacturer of your system. For my XPS laptop, it shows Dell:
[email protected]:~ $ sudo dmidecode | grep Vendor Vendor: Dell Inc. Vendor ID:
Model name with dmidecode
Look for the Product Name to confirm the name of your system. It shows my laptop's model for me:
[email protected]:~ $ sudo dmidecode | grep Product Product Name: XPS 13 9380 Product Name: 0KTW76
Motherboard with dmidecode
Finding the motherboard model will require you to search through the less pager output (press / and start typing word motherboard, then scroll up and down).
Here's what one of my dedicated servers shows:
Handle 0x0002, DMI type 2, 15 bytes Base Board Information Manufacturer: Supermicro Product Name: X11SSE-F Version: 1.01 Serial Number: ZM163S009892 Asset Tag: To be filled by O.E.M. Features: Board is a hosting board Board is replaceable Location In Chassis: To be filled by O.E.M. Chassis Handle: 0x0003 Type: Motherboard Contained Object Handles: 0
Serial numbers with dmidecode
Just grep for the word Serial to find lots of serial numbers of various recognised devices. One of them (the first one in the output) is the Dell's service tag that you usually need for hardware support:
[email protected]:~ $ sudo dmidecode | grep Serial Serial services are supported (int 14h) Serial Number: 50G8V** Serial Number: /50G8V**/CN***00***00F8/ Serial Number: 50G8V** Serial Number: Not Specified Serial Number: Not Specified Serial Number: To Be Filled By O.E.M. Serial Number: 0A3E Debug Use USB(Disabled:Serial)
There's lots of other things dmidecode is useful for – I'll be sure to update the dmidecode command page going forward.