Options available in `blkid` Command in Linux

Here is a list of some common options for the blkid command:

option

long option

description

-d

–no-encoding

Don’t encode non-printing characters.

-g

–garbage-collect

Remove devices that no longer exist.

-h

–help

Display a usage message and exit.

-k

–list-filesystems

List all known filesystems and RAIDs and exit.

-o

–output FORMAT

Use the specified output format. FORMAT can be:

  • full – print all tags
  • value – print value of the tags
  • list – print devices in a user-friendly format
  • device – print device name only

and so on.

-t

–match-token NAME=VALUE

Search for block devices having attributes named NAME and value as VALUE. NAME can be TYPE, LABEL or UUID.

-U

–uuid [UUID]

Look up the device that uses this filesystem UUID.

For more options and details for the command check out the manual for the blkid command:

man blkid

blkid Command Examples in Linux

blkid is a command to locate or print block device attributes. A block device can be a hard drive, solid-state drive (SSD), or removable storage device, such as a USB drive. It can determine the type of content (e.g., filesystem or swap) that a block device holds, and also the attributes (tokens, NAME=value pairs) from the content metadata (e.g., LABEL or UUID fields). The blkid command is part of the util-linux package. You need a Linux terminal to use this command.

Similar Reads

Syntax of `blkid` Command in Linux

blkid [OPTIONS] [DEVICE_NAME]...

Options available in `blkid` Command in Linux

Here is a list of some common options for the blkid command:...

Examples of blkid command in Linux

blkid has two main forms of operation: either searching for a device with a specific NAME=value pair, or displaying NAME=value pairs for one or more specified devices....

Conclusion

In this article we discussed the blkid command in Linux which is a crucial tool for identifying and displaying attributes of block devices, including hard drives and USBs. With options like listing filesystems, formatting output, and searching devices based on attributes, blkid provides a versatile solution for users managing storage devices from the Linux terminal. Its flexibility and functionality make it an essential resource for efficiently obtaining information about block devices on a system....