Linux "lsblk" Command Line Options and Examples
list block devices

lsblk lists information about all available or the specified block devices. The lsblk command reads the sysfs filesystem and udev db to gather information. If the udev db is not available or lsblk is compiled without udev support than it tries to read LABELs, UUIDs and filesystem types from the block device.


Usage:

lsblk [options] [device...]






Command Line Options:

-a
Also list empty devices. (By default they are skipped.)
lsblk -a ...
-b
Print the SIZE column in bytes rather than in a human-readable format.
lsblk -b ...
-D
Print information about the discarding capabilities (TRIM, UNMAP) for each device.
lsblk -D ...
-z
Print the zone model for each device.
lsblk -z ...
-d
Do not print holder devices or slaves. For example, lsblk --nodeps /dev/sda prints information about the sda device only.
lsblk -d ...
-e
Exclude the devices specified by the comma-separated list of major device numbers. Note that RAM disks (major=1) are excludedby default. The filter is applied to the top-level devices only.
lsblk -e ...
-f
Output info about filesystems. This option is equivalent to -o NAME,FSTYPE,LABEL,UUID,MOUNTPOINT. The authoritative informa‐tion about filesystems and raids is provided by the blkid(8) command.
lsblk -f ...
-h
Display help text and exit.
lsblk -h ...
-I
Include devices specified by the comma-separated list of major device numbers. The filter is applied to the top-level devicesonly.
lsblk -I ...
-i
Use ASCII characters for tree formatting.
lsblk -i ...
-J
Use JSON output format.
lsblk -J ...
-l
Produce output in the form of a list.
lsblk -l ...
-m
Output info about device owner, group and mode. This option is equivalent to -o NAME,SIZE,OWNER,GROUP,MODE.
lsblk -m ...
-n
Do not print a header line.
lsblk -n ...
-o
Specify which output columns to print. Use --help to get a list of all supported columns.The default list of columns may be extended if list is specified in the format +list (e.g. lsblk -o +UUID).
lsblk -o ...
-O
Output all available columns.
lsblk -O ...
-P
Produce output in the form of key="value" pairs. All potentially unsafe characters are hex-escaped (\x<code>).
lsblk -P ...
-p
Print full device paths.
lsblk -p ...
-r
Produce output in raw format. All potentially unsafe characters are hex-escaped (\x<code>) in the NAME, KNAME, LABEL, PARTLA‐BEL and MOUNTPOINT columns.
lsblk -r ...
-S
Output info about SCSI devices only. All partitions, slaves and holder devices are ignored.
lsblk -S ...
-s
Print dependencies in inverse order. If the --list output is requested then the lines are still ordered by dependencies.
lsblk -s ...
-t
Output info about block-device topology. This option is equivalent to -o NAME,ALIGNMENT,MIN-IO,OPT-IO,PHY-SEC,LOG-SEC,ROTA,SCHED,RQ-SIZE,RA,WSAME.
lsblk -t ...
-V
Display version information and exit.
lsblk -V ...
-x
Sort output lines by column. This option enables --list output format by default. It is possible to use the option --tree toforce tree-like output and than the tree branches are sorted by the column.NOTESFor partitions, some information (e.g. queue attributes) is inherited from the parent device.The lsblk command needs to be able to look up each block device by major:minor numbers, which is done by using /sys/dev/block. Thissysfs block directory appeared in kernel 2.6.27 (October 2008). In case of problems with a new enough kernel, check that CON‐FIG_SYSFS was enabled at the time of the kernel build.RETURN CODES0 success1 failure32 none of specified devices found64 some specified devices found, some not foundAUTHORSMilan Broz <mbroz@redhat.com>Karel Zak <kzak@redhat.com>ENVIRONMENTLIBBLKID_DEBUG=allenables libblkid debug output.LIBMOUNT_DEBUG=allenables libmount debug output.LIBSMARTCOLS_DEBUG=allenables libsmartcols debug output.LIBSMARTCOLS_DEBUG_PADDING=onuse visible padding characters. Requires enabled LIBSMARTCOLS_DEBUG.
lsblk -x ...