How To – Linux List Disk Partitions Command

In Linux, you can use the lsblk command to list the disk partitions. The lsblk command displays information about all available block devices in the system, including disk partitions.

Here’s how to use it:

  1. Open a terminal window.
  2. Type the following command and press Enter:
    lsblk

This will list all available block devices, including disks and their partitions, in a tree-like format, with each partition indented under the disk it belongs to.

The output of the lsblk command provides information such as the device name, type, size, and mount point, among other things.

You can also use options with the lsblk command to customize the information displayed. For example, you can use the -o option to specify which columns of information you want to display, and the -l option to display information in a list format rather than the default tree format.

Here’s an example of how you can use these options to display only the device name, size, and mount point of each partition:

lsblk -o NAME,SIZE,MOUNTPOINT

This will produce output similar to the following:

NAME SIZE MOUNTPOINT
sda 8G
├─sda1 200M /boot
└─sda2 7.8G /

Note that in the above example, sda is the disk and sda1 and sda2 are its partitions.

Leave a Comment