LinuxCommandLibrary

lsblk

TLDR

List all storage devices in a tree-like format

$ lsblk
copy
Also list empty devices
$ lsblk -a
copy
Print the SIZE column in bytes
$ lsblk -b
copy
Output info about filesystems
$ lsblk -f
copy
Output info about block-device topology
$ lsblk -t
copy
Use ASCII characters for tree formatting
$ lsblk -i
copy
Add extra columns to output
$ lsblk -o NAME,SIZE,FSTYPE,MOUNTPOINT,MODEL
copy

SYNOPSIS

lsblk [-a] [-b] [-f] [-t] [-o columns] [device...]

DESCRIPTION

lsblk lists information about all available or specified block devices. It reads the sysfs filesystem and udev database to gather information and displays it in a tree-like format showing the relationship between devices and partitions.

PARAMETERS

-a, --all

Also list empty devices
-b, --bytes
Print SIZE column in bytes
-f, --fs
Output info about filesystems (FSTYPE, LABEL, UUID, MOUNTPOINT)
-t, --topology
Output block device topology information
-i, --ascii
Use ASCII characters for tree formatting
-l, --list
Produce output in list format
-o, --output columns
Specify which columns to output
-e, --exclude list
Exclude devices by major device numbers
-n, --noheadings
Don't print column headings
-p, --paths
Print full device paths
-J, --json
Output in JSON format

AVAILABLE COLUMNS

NAME, KNAME, MAJ:MIN, FSTYPE, MOUNTPOINT, LABEL, UUID, SIZE, MODEL, SERIAL, TYPE, TRAN, RO, RM, HOTPLUG, ROTA

CAVEATS

Some information may require root privileges. Mounted filesystems show mount points; unmounted show blank.

HISTORY

Part of util-linux package. Provides a more readable alternative to /proc/partitions and fdisk -l.

SEE ALSO

blkid(8), fdisk(8), findmnt(8), df(1)

Copied to clipboard