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 Ibmi Media, We will look into how to use the lsblk command in Linux.
To install lsblk, simply run the below command:
$ sudo apt install util-linux
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
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