lsblk
Processes and system
Usage
lsblk [-f]Lays out the disks and their partitions as a tree; it does not show unpartitioned free space (that is fdisk or parted), and it is Linux only, so macOS uses `diskutil list`.
Common flags
| Flag | Meaning |
|---|---|
| -f | Add filesystem type, label and UUID for each partition. |
| -o NAME,SIZE,FSTYPE,MOUNTPOINT | Pick exactly the columns you want. |
| -p | Print full device paths such as /dev/sda1. |
| -n | No header row, for scripts. |
| -J | JSON output. |
Examples
lsblk -fEvery disk and partition with its filesystem and mount point.
lsblk -o NAME,SIZE,MOUNTPOINTA short table for checking a device name before writing to it.
What is running and what is eating the machine. Identifying it comes before killing it.
How to read this
- Square brackets [ ] mark a part you may leave out.
- An ellipsis … means you can list more than one.
- Flags are case-sensitive — in some commands -r and -R do different things.
Questions
Q. What does lsblk do?
Lays out the disks and their partitions as a tree; it does not show unpartitioned free space (that is fdisk or parted), and it is Linux only, so macOS uses `diskutil list`.
Q. How do I type it?
lsblk [-f] — square brackets mark the parts you can leave out.
Q. How many flags are worth knowing?
5 are listed here; the full set is in man lsblk. This command sits under Processes and system.
Related commands
man page: man lsblk