Skip to content
shellmap

lsblkList block devices as a tree — disks, partitions, RAID across all 5 shells

Equivalents in every shell

Bashunix
lsblk

Part 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.

Zshunix
lsblk

Same `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.

Fishunix
lsblk

Same 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).

PowerShellwindows
Get-Disk

Three 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.

cmd.exewindows
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

Bash
lsblk -f
PowerShell
Get-Disk | Get-Partition | Get-Volume | Format-Table DriveLetter, FileSystemType, FileSystemLabel, SizeRemaining, Size
cmd.exe
wmic logicaldisk get name,filesystem,size,freespace

List ONLY physical disks (exclude partitions and LVM children)

Bash
lsblk -d -o NAME,SIZE,MODEL,SERIAL
PowerShell
Get-PhysicalDisk | Select-Object FriendlyName, MediaType, Size, BusType
cmd.exe
wmic diskdrive get model,serialnumber,size

Emit JSON for downstream tooling

Bash
lsblk -J -o NAME,SIZE,FSTYPE,MOUNTPOINT
PowerShell
Get-Disk | Get-Partition | ConvertTo-Json -Depth 3

Gotchas

  • `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.

WSL & PowerShell Core notes

pwshOn Linux pwsh `lsblk` is just an external — invoke directly. The pwsh-native `Get-Disk` / `Get-Partition` / `Get-Volume` family is Windows-only because it talks to the WMI / CIM `Storage` provider. Portable pwsh scripts that need block-device info should branch: `if ($IsWindows) { Get-Disk } else { & lsblk -J | ConvertFrom-Json }` — `ConvertFrom-Json` turns the `-J` output into a navigable object graph.
WSLInside WSL2 `lsblk` shows the WSL VHD as `/dev/sdb` (or similar) plus any disks attached via `wsl --mount`. Windows-side disks are NOT listed by default — they appear at `/mnt/c`, `/mnt/d` via DrvFs but DrvFs is a 9P filesystem, not a block device, so `lsblk` (which reads `/sys/block`) does not see them. To inspect Windows disks from inside WSL: shell out via `powershell.exe Get-Disk` from the WSL prompt.

Related commands