lsblk command is used in Linux and Unix-like operating systems to list information about block devices, such as hard drives and partitions, in a tree-like format. It provides a comprehensive view of the available storage devices and their corresponding attributes.
The basic syntax of the
lsblk command is as follows:
[options] represents the various flags and parameters you can use with the command.
Some commonly used options with
--all: Shows all devices, including empty ones.
--nodeps: Omits dependency information.
--paths: Displays the full device path.
--topology: Shows the topology information.
--mib: Displays sizes in mebibytes (MiB).
--noheadings: Suppresses header lines.
--output: Specifies the columns to display.
To use the
lsblk command, open a terminal and enter the command followed by the desired options. Here are a few examples:
- List all available block devices:
- Display additional information, including the device type and size:
lsblk -o NAME,TYPE,SIZE
- Show the complete device path for each block device:
- View the block device tree with topology information:
These are just a few examples, and there are many more options and variations you can use with the
lsblk command. To explore additional options and information, you can refer to the
lsblk command’s manual page by typing
man lsblk in the terminal.