lsblk Command

The lsblk command in Linux is used to list information about all available or specified block devices. It provides a tree-like overview of storage devices, including hard drives, SSDs, USB drives, and their partitions, making it easy to understand disk layouts.

Syntax

lsblk [options] [device...]

Description

lsblk reads the sysfs filesystem and udev db to gather information about block devices. It then presents this information in a tree-like format, showing dependencies between devices.

Common uses include:

  • Listing all block devices and their partitions
  • Checking disk sizes and mount points
  • Understanding disk hierarchy and dependencies
  • Identifying device types (disk, rom, loop, etc.)

Common Options

Option Description
-a, --all List all block devices, including empty ones.
-b, --bytes Print the SIZE column in bytes rather than in a human-readable format.
-d, --nodeps Don't print holders or slaves.
-f, --fsapce Output info about filesystems.
-i, --ascii Use ASCII characters for tree formatting.
-m, --perms Output info about permissions.
-p, --paths Output full device paths.
-r, --raw Output in raw format (no tree).
-t, --topology Output info about topology.
-o, --output list Output specific columns.

Examples

List all block devices

lsblk

Displays a tree-like list of all block devices and their partitions.

List with file system information

lsblk -f

Shows file system type, UUID, and mount points for each device.

List in raw format (no tree)

lsblk -r

Outputs device information in a raw, column-based format, useful for scripting.

List specific device

lsblk /dev/sda

Displays information only for the specified device (e.g., /dev/sda).

List with full paths

lsblk -p

Shows the full path to each block device.

See also