The quickest way to get a BIOS serial number on Linux:
sudo dmidecode -s system-serial-number
That’s usually all you need. dmidecode reads the DMI/SMBIOS table and prints the serial number directly.
Other options
If dmidecode isn’t available or doesn’t return what you need:
# lshw
sudo lshw -C bios | grep serial
# /sys class interface (no sudo needed)
cat /sys/class/dmi/id/product_serial
The /sys/class/dmi/id/ path is the cleanest option if you want to avoid sudo. It exposes several DMI fields:
/sys/class/dmi/id/product_serial
/sys/class/dmi/id/bios_serial
/sys/class/dmi/id/board_serial
Note that product_serial is the system serial number, bios_serial is the BIOS board serial, and board_serial is the motherboard serial. They’re not always the same thing.
Virtual machines
On VMs these fields often return placeholder values or nothing at all. VMware typically returns something like VMware-XX XX XX XX XX XX XX XX. If you need the host’s serial number from inside a guest, you’ll need to query the host directly.