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:
- Open a terminal window.
- Type the following command and press Enter:
lsblk
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,MOUNTPOINTThis will produce output similar to the following:
NAME SIZE MOUNTPOINTrnsda 8G
├─sda1 200M /bootrn└─sda2 7.8G /Note that in the above example, sda is the disk and sda1 and sda2 are its partitions.
