brewedbits.dev

Personal blog with guides and news on selfhosting, Linux and AI, from the Netherlands

nextDash nextdash --aboutYour bookmarks. Your terminal. checks your links knows your Docker host one container, no cloudLive demo →nextdash.cc ↗

Tip: dmidecode -s prints one hardware value, like the BIOS version

Hardware
~/tips/tip-hardware-dmidecode-s-string

sudo dmidecode -s bios-version

Prints a single DMI string such as BIOS version or product name, handy in scripts.

dmidecode is famous for dumping a wall of text. If you only want one thing, such as the BIOS version before a firmware update, there is a flag that prints just that.

sudo dmidecode -s bios-version

-s (--string) takes a keyword and prints only that value, with no headers around it. Some keywords I find useful:

  • bios-vendor and bios-version
  • system-product-name
  • baseboard-product-name
  • processor-version
sudo dmidecode -s system-product-name

The caveat: you can use only one keyword per call, and -s can’t be combined with -t. A wrong keyword makes dmidecode print the list of valid ones and exit with an error, which is a decent way to see them all. On multi-CPU machines processor-version can return more than one line.

Also, on Linux most of these values live in /sys/devices/virtual/dmi/id, and the man page says most of those files are readable without root. For a quick look in a script, cat /sys/devices/virtual/dmi/id/bios_version may be all you need.

A small script that prints the product name and BIOS version of each machine makes a nice inventory, especially when the BIOS version is what a vendor’s support page asks for.

Further reading: dmidecode man page

More Hardware tips disable_poe_fan=1 sudo lshw -short rfkill list udevadm monitor Get-CimInstance Win32_BIOS | Select-Object Manufacturer, SMBIOSBIOSVersion, ReleaseDate, SerialNumber All Hardware tips (8) All topics

Link