lsblk Command in Linux - Explained with examples

The lsblk command in Linux allows the user to see details of block devices and these block devices (except ram disks) are files corresponding to devices connected to the computer. To get the information it displays it will query /sys virtual filesystem and udev db. Its output will be displayed like a tree structure. 

Here at LinuxAPT, We will look into how to use the lsblk command in Linux.

How to install the lsblk command ?

To install lsblk, simply run the below command:

$ sudo apt install util-linux

How to use lsblk command ?

1. Display block devices:

$ lsblk

2. Display empty block devices:

$ lsblk -a

3. Display size information in bytes:

$ lsblk -b

4. Display zone model for devices:

$ lsblk -z

5. Skip slave entries:

$ lsblk -d

6. Display owner, group, mode:

$ lsblk -m

7. Display help information:

$ lsblk --help

[Need support in fixing Linux system issues ? We can help you. ]

This article covers how to use the lsblk command in Linux. In fact, lsblk prints all block devices (except RAM disks) in a  tree-like format  by  default.   Use  lsblk --help to get a list of all available columns.

The lsblk command in Linux lists block devices. 

Following is Lsblk's syntax:

$ lsblk [options] [device...]

Lsblk can be used to retrieve a vast range of information about all the block devices attached to the system.

How to make lsblk display info about device owner, group, and mode ?

This can be achieved using the -m command line option:

$ lsblk -m

Related Posts