lsblk — List block devices as a tree — disks, partitions, RAID across all 5 shells
Equivalents in every shell
lsblkPart of `util-linux`. Reads `/sys/block` — no privileged access required. Default output: NAME, MAJ:MIN, RM (removable), SIZE, RO, TYPE, MOUNTPOINTS. `-f` adds FSTYPE + UUID + LABEL; `-o +MODEL,SERIAL` adds vendor info. `lsblk -J` emits JSON for scripts. Strictly Linux — does not exist on macOS or BSD.
lsblkSame `util-linux` binary on Linux. NOT available on macOS — the macOS equivalent is `diskutil list` (shows partitions in a tree-like format with sizes, UUIDs, and mountpoints) or `system_profiler SPStorageDataType` for richer detail.
lsblkSame external. On Linux fish, no fish-specific wrapper exists. For JSON-driven pipelines: `lsblk -J | jq '.blockdevices[] | select(.type=="disk") | .name'` lists just the top-level disks (excluding partitions and LVM children).
Get-DiskThree cmdlets cover what Linux `lsblk` shows in one. `Get-Disk` — physical drives (model, serial, total size, partition style). `Get-Partition` — partitions per disk (offset, size, drive letter, GPT type). `Get-Volume` — filesystem-level view (drive letter, FS, label, free/used). Pipe `Get-Disk | Get-Partition | Get-Volume` for a `lsblk -f`-style tree.
wmic logicaldisk get name,size,freespace,filesystem`wmic` is DEPRECATED in Windows 11 22H2+ but still ships. For disk-level info: `wmic diskdrive get model,serialnumber,size`. The modern replacement is `powershell -c "Get-Disk | Format-Table -AutoSize"`. `diskpart` (interactive: `list disk`, `list volume`, `list partition`) is the deepest cmd-side tool for partitioning but requires admin and an interactive `diskpart>` prompt.
Worked examples
Show block devices with filesystem type, UUID, and mountpoint
lsblk -fGet-Disk | Get-Partition | Get-Volume | Format-Table DriveLetter, FileSystemType, FileSystemLabel, SizeRemaining, Sizewmic logicaldisk get name,filesystem,size,freespaceList ONLY physical disks (exclude partitions and LVM children)
lsblk -d -o NAME,SIZE,MODEL,SERIALGet-PhysicalDisk | Select-Object FriendlyName, MediaType, Size, BusTypewmic diskdrive get model,serialnumber,sizeEmit JSON for downstream tooling
lsblk -J -o NAME,SIZE,FSTYPE,MOUNTPOINTGet-Disk | Get-Partition | ConvertTo-Json -Depth 3Gotchas
- `lsblk` is LINUX-ONLY (`util-linux`). macOS and BSD do not ship it — `lsblk` returns "command not found". Use `diskutil list` on macOS, `geom disk list` / `gpart show` on FreeBSD. Cross-platform shell scripts that try `lsblk` need to feature-detect before invocation.
- Removable media may show as `RM=1` in `lsblk` output but that's based on `/sys/block/<dev>/removable`, which lies for some USB-to-SATA adapters and Thunderbolt-attached drives. Don't use `RM` as the sole signal for "is this safe to unplug" — check that no mountpoint is held and that `udisks2` reports no in-flight writes.
- The PowerShell `Get-Disk` / `Get-Partition` / `Get-Volume` trio is Windows-only — they require the `Storage` module that ships with Windows 8 / Server 2012 and later. On pwsh-on-Linux these cmdlets are NOT present; only `Get-PSDrive` works there and it only shows PowerShell-mapped drives, not the underlying block layout.
- `lsblk` shows TREE nesting — a disk `sda` with two partitions becomes three rows (`sda`, `├─sda1`, `└─sda2`). Scripts that grep for `sda` match all three; use `lsblk -d` (disks only) or `-J` JSON output for reliable parsing. Likewise `lsblk -n -p -d -o NAME` emits one path per disk for `for d in $(...)` loops.
- LVM, LUKS, and MD RAID add MORE rows under each underlying block device — an LVM volume group with three PVs and five LVs shows up as fifteen-plus rows. `lsblk -t` adds queue characteristics (rotation, RA, RQ-size) so SSDs vs HDDs can be told apart for tuning.