List devices
lsblk
Tree of block devices
lsblk -f
Filesystem type, label, UUID, usage
lsblk -a
Include empty and hidden devices
lsblk -d
Disks only, no partitions
lsblk -l
Flat list instead of tree
lsblk -p
Print full /dev/... paths
lsblk <disk>
Show only this disk and its children
lsblk -s <part>
Show parents instead of children
lsblk -e7
Hide loop devices (major 7)
lsblk -i
ASCII tree, safe for pasting
lsblk -t
Topology: sector sizes, scheduler
lsblk -m
Owner, group and mode
lsblk -D
Discard (TRIM) support
lsblk -S
SCSI devices: HCTL, vendor, transport
Choose columns
lsblk -o NAME,SIZE,TYPE,MOUNTPOINTS
Pick output columns
lsblk -o +UUID,LABEL
Add columns to the default set
lsblk -O
Print every column
lsblk -H
List available columns
lsblk -x SIZE
Sort by a column
lsblk -o NAME,SERIAL,MODEL,TRAN
Identify a physical disk
lsblk -o NAME,ROTA,HOTPLUG,RM
SSD vs HDD, removable flags
lsblk -o NAME,PARTUUID,PARTLABEL
Partition table identifiers
findmnt
findmnt
Mounted filesystems as a tree
findmnt <path>
Mount that serves this mount point or device
findmnt -T <path>
Mount that contains this path
findmnt -no SOURCE <path>
Just the device behind a path
findmnt -S UUID=<uuid>
Find a mount by device tag
findmnt -t ext4,xfs
Limit to filesystem types
findmnt --real
Hide pseudo filesystems (proc, sysfs)
findmnt -l
Flat list instead of tree
findmnt -o TARGET,SOURCE,FSTYPE,OPTIONS
Choose columns
findmnt -D
Output like df
findmnt -s
Read /etc/fstab instead of live mounts
findmnt --verify
Check fstab for mistakes
findmnt -R <path>
Include submounts
findmnt -p
Watch for mount changes
Recipes
Find the USB stick safely
lsblk -o NAME,SIZE,MODEL,TRAN,HOTPLUG,MOUNTPOINTSlsblk -p -d -o NAME,SIZE,MODEL /dev/sdb
fstab entry from a UUID
uuid=$(sudo blkid -s UUID -o value /dev/sdb1)echo "UUID=$uuid /mnt/data ext4 defaults 0 2"findmnt --verify
What is using this path?
findmnt -T /var/lib/dockerlsblk -s $(findmnt -no SOURCE -T /var/lib/docker)df -h /var/lib/docker
Disk names and sizes as JSON
lsblk -J -b -d -o NAME,SIZE,TYPE | jq -r '.blockdevices[] | "\(.name) \(.size)"'