lsblk: list block devices
Table of Contents
You can list and find everything about your block devices (hard drives, pen drives, etc.) with one great command.
$ lsblk
NAME   MAJ:MIN RM   SIZE RO TYPE MOUNTPOINTS
sda      8:0    0 465.8G  0 disk 
├─sda1   8:1    0   499M  0 part 
├─sda2   8:2    0   100M  0 part /boot
├─sda3   8:3    0    16M  0 part 
├─sda4   8:4    0 143.4G  0 part 
├─sda5   8:5    0   270G  0 part /
└─sda6   8:6    0  51.8G  0 part You can specify which columns to print with -o <list>. For example, to show block device name and its filesystem UUID:
$ lsblk -o name,uuid
NAME   UUID
sda    
├─sda1 6C86CBD886CBA146
├─sda2 CE27-DB1F
├─sda3 
├─sda4 76BE2E00BE2DBA0F
├─sda5 cbbf7ee3-ba60-4cee-b0c4-e9bf918a4e8e
└─sda6 3089131888432118255- For a complete list of available columns, type lsblk --help. Some of the most useful columns arename,uuid,partuuid,label,size,fstype,mountpoint,pathandpartlabel(to show Windows partitions labels).
You can use this info, among other things, for editing /etc/fstab (fstab: what it is and how to use it) or formatting a file system (fsver column is useful when formatting FAT filesystems):
$ lsblk -o name,fstype,fsver
NAME   FSTYPE     FSVER
sda               
├─sda1 ntfs       
├─sda2 vfat       FAT32
├─sda3            
├─sda4 ntfs       
├─sda5 ext4       1.0
└─sda6 zfs_member 5000If you have any suggestion, feel free to contact me via social media or email.
Latest tutorials and articles:
Featured content:
 
  
  
  
  
  
  
  
  
  
  
 