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 like:
- [Solution] Missing logstash-plain.log File in Logstash
- Understanding Netstat – The Network Monitoring Tool
- Top 40 Useful Linux Command Snippets
- Using Elasticsearch Ingest Pipeline to Copy Data from One Field to Another
- Top 10 Useful Windows Commands
- Essential Commands For Process Management in Kali Linux
- How To Install Python 2.7.18 From The Source
- How To Parse SSH Authentication Logs with Logstash
- A Comprehensive Guide to File System Commands in Linux
- Essential File Compression Commands in Linux