Contents
What does Lsblk show?
Lsblk is used to display details about block devices and these block devices(Except ram disk) are basically those files that represent devices connected to the pc. It queries /sys virtual file system and udev db to obtain information that it displays. And it basically displays output in a tree-like structure.
How check Lsblk Linux?
lsblk lists information about all available or the specified block devices. The lsblk command reads the sysfs filesystem and udev db to gather information. If the udev db is not available or lsblk is compiled without udev support, then it tries to read LABELs, UUIDs and filesystem types from the block device.
What is the Lsblk command for?
The lsblk Linux command is a useful command which lists information about all or the specified block devices. It queries the /sys virtual file system to obtain the information that it displays. The command displays details about all block devices excluding except RAM disks in a tree-like format by default.
How to list all Linux disk devices in lsblk?
Note: the -a flag forces lsblk to list also empty devices. In the first column you can see all the connected devices, in the image above you can see 3 devices: sda, sdc and sdd. Lets see some information on each. The NAME column shows the name of each disk device and partition.
How to get list of all available columns in lsblk?
Use lsblk –help to get a list of all available columns. The default output, as well as the default output from options like –fs and –topology , is subject to change. So whenever possible, you should avoid using default outputs in your scripts.
How to print list of empty devices in lsblk?
For your kind information, By default, lsblk command doesn’t print list of empty devices. If you want to view all devices information including empty files then use command followed by -a option. So the command can be used as follows:
What do I need to know about lsblk?
Gather data for a Linux instance other than the instance from which the lsblk command is issued. The specified directory is the system root of the Linux instance to be inspected. This option is designed for the testing purpose. For partitions, some information (e.g. queue attributes) is inherited from the parent device.