Get Serial Number of a Laptop in Ubuntu

A serial number uniquely identifies your device. There are various ways to get a laptop’s serial number. If you flip your laptop then, you will see it on a sticker. Or, if your laptop has a removable battery then it is present on a sticker inside the battery compartment. In addition, we can get it from the BIOS itself. In this article, we will focus on how to get the Serial Number of a Laptop in the Ubuntu distribution.

Apart from uniquely identifying your device, a serial number acts as a deterrent against theft.

Note: The following operations would require you to have superuser privileges. In case you don’t have one, then contact your System Administrator for assistance.

Get the Serial Number of a Laptop in Ubuntu

We can get our laptop’s Serial Number through the command-line utility – dmidecode. Now, open a terminal and issue the following –

sudo dmidecode -t 1 | grep -i serial

It would ask for the password and on successful authentication, display the serial number.

Serial Number: XXXXXXXXXXX

where,

dmidecode – it decodes the Desktop Management Interface (DMI) table and displays the output in a human-readable format. A Desktop Management Interface provides us with a framework to manage our Laptop’s components.

-t option is for DMI types;

  1. for System;
  2. Baseboard;
  3. Chassis;
  4. Processor etc.

We will explain each of the available DMI types in a separate article in detail.

| pipe is used to redirect the output of one command to the input of another. If we only issue the command – sudo dmidecode -t 1, then it will print other System information also – Manufacturer, Product Name, UUID, etc. Since, for this article, we limit ourselves to extracting the serial number. Therefore, we use the grep command to get the desired information.

grep – it searches and prints the specific pattern in a line.

-i option is used to ignore the case.

In conclusion, we have discussed how to get the laptop’s serial number through dmidecode & grep command-line utility.

Similar Posts