Get Serial Number of a Laptop in Ubuntu distribution

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 to, we can get it from the BIOS itself. In this article, we would focus on how to get Serial Number of a Laptop in Ubuntu distribution.

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

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

Get Serial Number of a Laptop in Ubuntu

We can get our laptop’s Serial Number through 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, displays the serial number.

Serial Number: XXXXXXXXXXX

where,

dmidecode – it decodes Desktop Management Interface (DMI) table and displays the output in a human-readable format. A Desktop Management Interface provides us 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 output of one command to the input of other. 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 the purpose of this article we limit ourselves to extract the serial number. Therefore, we use grep command to get the desired information.

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

-i option is used to ignore case.

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