Skip to content

lsblk Linux Command Guide

The lsblk command in Linux is used to list block devices along with information about their sizes, mount points, and filesystem types. It provides a clear overview of the storage devices connected to the system, making it easier to identify and manage storage devices. By default, lsblk displays information in a tree-like format, showing the relationships between different devices. This command is useful for system administrators and users who need to gather information about block devices on their Linux system.

lsblk Syntax:

Terminal window
lsblk [options] [parameters]

Options:

OptionDescription
-a, —allList all devices
-d, —nodepsDo not print slaves, holders and partmaps
-e, —excludeExcludes the specified major-minor device number
-f, —fsOutput info on filesystems
-i, —asciiOutput ASCII parttable
-l, —listOutput in list format
-m, —scsiOutput info in SCSI generic mode
-n, —noheadingsDo not print a header line
-o, —outputSpecify columns to display
-p, —pairsProduce output suitable for parsing

Parameters:

ParameterDescription
PATHSpecify a device or mount point to list information
DEVICESpecifying the device to list information
-a, —allList all devices
-b, —bytesPrint size in bytes
-h, —humanPrint sizes in human readable format
-t, —topologyOutput info in topology format

lsblk Command Samples:

List all block devices

Terminal window
lsblk

Display information about all available block devices.

List block devices with additional information

Terminal window
lsblk -a

Display all block devices including virtual ones.

Display all available block devices including loop devices

Terminal window
lsblk -l

Show all block devices, including loop devices.

Show only the block devices in a tree-like format

Terminal window
lsblk -t

Display block devices in a tree-like format.

Show all block devices with filesystem information

Terminal window
lsblk -f

Display all block devices with filesystem information included.

Display block devices and additional metadata

Terminal window
lsblk -m

Show block devices with additional metadata information.

Show all block devices with information in JSON format

Terminal window
lsblk -J

Display block devices along with metadata in JSON format.

How do I list all block devices in Linux using lsblk?

To list all block devices in Linux with lsblk, run the following command:

Terminal window
lsblk

How can I display more details, including mount points, with lsblk in Linux?

To display more details, including mount points, when using lsblk in Linux, use the following command:

Terminal window
lsblk -f

How can I show the size of each block device in lsblk on Linux?

To show the size of each block device when using lsblk in Linux, execute the following command:

Terminal window
lsblk -b

How do I display the tree-like format of partitions with lsblk in Linux?

To display the tree-like format of partitions using lsblk in Linux, use the following command:

Terminal window
lsblk -i

How can I list all USB devices in Linux using lsblk?

To list all USB devices in Linux with lsblk, run the following command:

Terminal window
lsblk -d -o name,tran,rm,type

How can I list only specific block devices using lsblk in Linux?

To list only specific block devices with lsblk in Linux, use the following command, replacing <device> with the device name:

Terminal window
lsblk /dev/<device>

Applications of the lsblk command

  • Viewing information about block devices
  • Listing details about storage devices and their partitions
  • Checking the device name, size, type, and mount points
  • Displaying hierarchical information about the storage devices
  • Assisting in identifying disk and partition information
  • Providing an overview of the block devices available on the system