Linux for Developers
/Intermediate
lsblk
Definition
List Block Devices. A command that prints all available block devices (physical hard drives, SSDs, USBs) in a visual tree format, showing their partitions and mount points.
Explain Like I'm New
Looking at the physical hardware. It shows you the actual physical disks plugged into the computer, regardless of whether they have been mounted into the file system or not.
Real World Example
You buy a new 1TB hard drive and plug it into the server. It doesn't show up in `df` because it isn't mounted. You type `lsblk`. You see `sdb - 1000G` listed. Now you know the OS physically recognizes the new drive.
Common Use Cases
- •Identifying new hardware
- •Planning partitions
Interview Questions
basic
- Does `lsblk` show you how much free space is left on the drive?
intermediate
- In the output of `lsblk`, what does `sda1` mean compared to `sda`?