How to Find the Hardware Serial Number of a Linux Server Using the dmidecode Command

Why You Need the Serial Number

When a physical server experiences a hardware failure (like a dead stick of RAM or a failing power supply), you must open a support ticket with the manufacturer (Dell, HP, Lenovo). The very first thing the support technician will ask for is the server’s Service Tag or Serial Number to verify your warranty status. If the server is racked in a cold data center 500 miles away, you cannot simply walk over and read the sticker on the chassis. The dmidecode command allows you to pull this exact hardware information directly from the motherboard’s BIOS over an SSH connection.

Step 1: Understand DMI Data

Desktop Management Interface (DMI), also known as SMBIOS, is a framework used by hardware manufacturers to expose information about the physical components (motherboard, chassis, processor, memory) to the operating system. The dmidecode command parses this raw binary data and formats it into human-readable text.

Ensure the utility is installed. It is included by default on most systems, but if not:

Ubuntu/Debian: sudo apt install dmidecode
RHEL/CentOS: sudo yum install dmidecode

Step 2: Pull the System Serial Number

Because accessing the raw memory addresses containing DMI data is restricted by the kernel, you must run dmidecode with root privileges.

To pull the primary serial number (often called the “Service Tag” by Dell), use the -s (string) flag to extract exactly what you need:

sudo dmidecode -s system-serial-number

The terminal will instantly output the string (e.g., J8X9P22).

Step 3: Pull the Motherboard Serial Number

Occasionally, if a motherboard was replaced during a previous warranty repair, the primary system serial number might be blank or incorrect. In this case, you can pull the specific serial number printed directly on the baseboard (motherboard):

sudo dmidecode -s baseboard-serial-number

Step 4: View the Full System Information Block

If you need more than just the serial number—for example, if support asks for the exact Model Name or the specific BIOS revision—you can dump the entire “System” block type (Type 1) using the -t flag:

sudo dmidecode -t system

This will output a block of text detailing the Manufacturer (e.g., “Dell Inc.”), the Product Name (e.g., “PowerEdge R740”), the UUID, and the Serial Number all at once.

Step 5: Querying Virtual Machines

The dmidecode command works exactly the same on virtual machines, but the output will reflect the hypervisor rather than physical hardware.

If you run sudo dmidecode -s system-manufacturer on an AWS EC2 instance, it will return “Amazon EC2”. If you run it on a VMware VM, it will return “VMware, Inc.” and provide a unique VMware UUID as the serial number. This is an excellent method for a Linux script to programmatically determine if it is running on bare metal or inside a virtualized environment.

Get the best tech tips delivered straight to your inbox.

Join thousands of readers mastering Apple, Google, Microsoft, and Linux.