The blkid program is a command-line utility that displays information about available block devices. It can determine the type of content (e.g. filesystem, swap) a block device holds and also attributes (tokens, NAME=value pairs) from the content metadata (e.g. LABEL or UUID fields).
In this tutorial, we learn about blkid command in Linux and how to use it to find UUIDs.
Simply running blkid without any argument will list all the available devices with their Universally Unique Identifier (UUID), the TYPE of the file system, and the LABEL if it's set.
Listing device UUID
If you wish to have information displayed only for a specific device you can use the device name as an option after blkid to do so:
Also if you know the UUID of a device but don't know the device name and wish to find it out you can use the -U option like this:
blkid -U d3b1dcc2-e3b0-45b0-b703-d6d0d360e524
If you wish to obtain more detailed information you can use the -p and -o udev option to have it display in a nice format like this:
blkid -po udev /dev/sda1
Sometimes the device list might not be updated, if you think this is the case you can use the -g option that will perform a garbage collection pass on the blkid cache to remove devices that no longer exist.
In this tutorial, we learned blkid command and how to use it to list block device details. Blkid is mainly used to list disk/partitions UUID.