UUID in Linux

What is UUID

The UUID refers to a Universally Unique Identifier that consists of 128-bit numbers that have the probability of having duplicates close enough to zero but not zero in the local system. It was originally used in the Networking Computing System and then, later standardized by the Open Software Foundation.

The UUID is divided into five groups separated by hyphens (-) consisting of 8-4-4-4-12 characters in each group. In total it consists of 36 characters. You can see the UUID string like the string shown below.


In Linux, UUID is used to uniquely identify the disk partitions which helps to mount the partitions correctly even if there are hundreds of disks in the system. Each time you install the storage device in another Linux system you don’t need to worry about updating the UUID of the partition as it remains unchanged.

In this article, we will see how we can generate a UUID and a way to view the UUID of the disk.

Find Partition UUID

Using blkid

The blkid is the command-line utility that displays attributes of the available block devices. It is preinstalled in most Linux distributions. You can use the following command to view the UUID and other attributes of the all available partition.

$ sudo blkid

Linux blkid command - ubuntu list disk uuid

UUID using blkid.

Using ls

You can find all the partitions and their UUID in files in the Linux system as Linux represents all devices along with storage devices as files. So you can list out all partitions and their UUID using the following command.

$ sudo ls -l /dev/disk/by-uuid

get UUID using ls command

UUID using ls.

Using lsblk

The lsblk command is also used to display details about the block devices except for ram. It can be used to display the disk partition UUID on Linux systems. You can use the following command to view the UUID of the partition.

$ sudo lsblk -o NAME, PATH, TYPE, UUID

The Linux lsblk command

UUID using lsblk.

Generating UUID Using uuidgen Command

You can find the uuidgen command already installed in most of the Linux distributions. You can generate a single UUID using the uuidgen command. To create the UUID execute the following command.

$ uuidgen

uuidgen command usage

Generating UUID.

You can also generate more UUID at once using shell scripting. To generate UUID execute the following shell script in the shell.

$ for i in {1..5}; do uuidgen; done

Generating multiple uuid's

Generating Multiple UUID.


Universally Unique Identifiers are highly efficient and dependable for uniquely identifying the system and its files without disturbance. This article will help you understand and display all partitions assigned UUID and generate the UUID using the uuidgen command.

Categorized as Linux