Linux lsblk command

The 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:

lsblk [options]

Here, [options] represents the various flags and parameters you can use with the command.

Some commonly used options with lsblk include:

  • -a or --all: Shows all devices, including empty ones.
  • -d or --nodeps: Omits dependency information.
  • -p or --paths: Displays the full device path.
  • -t or --topology: Shows the topology information.
  • -m or --mib: Displays sizes in mebibytes (MiB).
  • -n or --noheadings: Suppresses header lines.
  • -o or --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:

  1. List all available block devices:
lsblk
  1. Display additional information, including the device type and size:
lsblk -o NAME,TYPE,SIZE
  1. Show the complete device path for each block device:
lsblk -p
  1. View the block device tree with topology information:
lsblk -t

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.