← 返回命令列表

Linux command

blkid 命令

安全

权限或系统影响较大,执行前请核对目标。

常用示例

Example

sudo blkid

Example

sudo blkid -o list

Example

sudo blkid -s UUID -o value [/dev/sdXY]

Example

sudo blkid -s TYPE -o value [/dev/sdXY]

Example

sudo blkid -L [mylabel]

Example

sudo blkid -U [uuid]

Probe

sudo blkid -p [/dev/sdXY]

说明

blkid lists all recognized partitions and their attributes including Universally Unique Identifier (UUID), filesystem type, and label. It uses the libblkid library to locate and identify block devices.

参数

-o, --output format
Output format: full, value, list, device, udev, export
-s, --match-tag tag
Show only the specified tag (UUID, TYPE, LABEL, etc.)
-c, --cache-file file
Read from specified cache file instead of default
-g, --garbage-collect
Perform garbage collection on the blkid cache
-l, --list-one
Look up only one device matching parameters
-L, --label label
Look up device by filesystem label
-U, --uuid uuid
Look up device by filesystem UUID
-p, --probe
Low-level superblock probing mode (bypass cache)
-i, --info
Print I/O limits (sector size, etc.)
-t, --match-token _NAME=value_
Search for block devices with tokens named NAME that have the specified value
-n, --match-types _list_
Restrict probing to a comma-separated list of superblock types
-u, --usages _list_
Restrict probing to a comma-separated list of usage types (filesystem, raid, crypto, other)

FAQ

What is the blkid command used for?

blkid lists all recognized partitions and their attributes including Universally Unique Identifier (UUID), filesystem type, and label. It uses the libblkid library to locate and identify block devices.

How do I run a basic blkid example?

Run `sudo blkid` in a terminal, then adjust file names, paths, flags, or remote targets for your system.

What does -o, --output format do in blkid?

Output format: full, value, list, device, udev, export