Home·Terminal commands

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

FlagMeaning
-fAdd filesystem type, label and UUID for each partition.
-o NAME,SIZE,FSTYPE,MOUNTPOINTPick exactly the columns you want.
-pPrint full device paths such as /dev/sda1.
-nNo header row, for scripts.
-JJSON output.

Examples

lsblk -f

Every disk and partition with its filesystem and mount point.

lsblk -o NAME,SIZE,MOUNTPOINT

A 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