A Universally Unique Identifier (UUID) is a 128-bit number used to identify unique items or objects. In Linux, UUIDs are used to uniquely identify partitions and file systems. They are commonly used in place of traditional device names (such as /dev/sda1) to ensure that the correct file system is mounted in the event that the device name changes. UUIDs can be generated using the uuidgen command in Linux.
1. Using ls command
The command ls -l /dev/disk/by-uuid/ will list all the available UUIDs of storage device on the system.
2. Using blkid command
The blkid command (short for “block ID”) is a command-line utility in Linux that is used to display information about block devices, such as partitions and file systems.
It can be used to determine the type of file system a device is using, as well as other information such as the UUID (Universally Unique Identifier) and LABEL of the device.
The blkid command can also be used to locate a device by its UUID or LABEL, which can be useful in identifying the correct device to mount. The command can be run without any arguments and it will list all the available block devices and their properties.
The blkid command is part of the util-linux package.
And if you want to get the UUID of a specific block, just specify the block name as shown:
Command: blkid /dev/sda2
3. Using lsblk command
lsblk is a command-line utility in Linux for displaying information about block devices, similar to the blkid command. It lists all the block devices on the system, including disk partitions and storage devices such as hard drives and USB drives.
The output of the lsblk command is organized in a tree-like format, showing the hierarchical relationship between different block devices. Each device is listed along with its major and minor number, size, type, filesystem type, mount point, and other information.
The command can be used to quickly identify the name, size, and type of a device, as well as whether it is currently mounted and where it is mounted. It is also part of the util-linux package.
And if you are on Ubuntu or your system is loaded with snap packages, they will be listed here too. In that case, you can filter those results using the grep command:
Command: lsblk -f | grep -v loop
You may also read:
- 50+ Useful Linux Commands with Examples
- Top 5 Best Linux Distros Every Developer Must Use
- 200+ Kali Linux Commands – Updated Cheatsheet
- [Tutorial] How to Install MobSF on Kali Linux 2022.1
- How To Install Jenkins on Ubuntu Machine
- [Tutorial] How To Install Webmin in Ubuntu
- How to Install Apache Tomcat on Ubuntu Machine
- A Step-by-Step Guide to Installing the LAMP Stack on Ubuntu
- [Linux] MySQL: The Easy Way to Check Your Version
- How To Install Remmina in Ubuntu – A Remote Desktop Client