Categories: TutorialsUbuntu

lsblk Command in Linux

Introduction

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. Now we’re gonna introduce you to using the lsblk command in Linux. Hope you understand.

Installing lsblk command

Run apt command to install:

$ sudo apt install util-linux

Output:

Using
Sponsored
lsblk command

1. Display block devices

$ lsblk

Output:

2. Display empty block devices

$ lsblk -a

Output:

3. Display size information in bytes

$ lsblk -b

Output:

4. Display zone model for devices

Sponsored
$ lsblk -z

Output:

5. Skip slave entries

$ lsblk -d

Output:

6. Display owner, group, mode

$ lsblk -m

Output:

7. Display help information

$ lsblk --help

Output:

Conclusion

We just introduced you to how to use the lsblk command in Linux.

Thank you for reading!

Karim Buzdar holds a degree in telecommunication engineering and holds several sysadmin certifications including CCNA RS, SCP, and ACE. As an IT engineer and technical author, he writes for various websites.

Ubuntu Server Admin

Recent Posts

How to Fix VMware’s “Could not open /dev/vmmon” Error on Ubuntu

You’ve recently installed VMware Workstation on your Ubuntu system and encountered the frustrating “Could not…

15 minutes ago

How to Fix Ubuntu 404 Errors While Fetching Dependencies

Have you ever found yourself staring at a terminal full of 404 errors while trying…

16 minutes ago

How to Fix ‘Please Install All Available Updates’ Error When Upgrading Ubuntu 18.04 to 20.04 LTS

One particularly frustrating error that many users face when trying to upgrade from Ubuntu 18.04 …

16 minutes ago

How to fix “Release is not valid yet” Error in Docker Containers

In the world of containerization, time synchronization issues can create unexpected roadblocks when working with…

16 minutes ago

How to fix “Externally Managed Environment” Pip Errors on Ubuntu

If you’ve recently upgraded to Ubuntu 23.04 or newer, you might have encountered a frustrating…

17 minutes ago

Ubuntu now officially supports NVIDIA Jetson: powering the future of AI at the edge

Canonical announces the General Availability of Ubuntu for the NVIDIA® Jetson Orin™ for edge AI…

7 hours ago