Skip to content
shellmap

dfReport mounted-filesystem free space and inode usage across all 5 shells

Equivalents in every shell

Bashunix
df -h

POSIX disk-free utility. `-h` is HUMAN-READABLE (KB/MB/GB) — without it, GNU `df` defaults to 1024-byte blocks (or 512-byte on POSIX-strict mode), confusingly small. `-i` switches from block usage to INODE usage — running out of inodes feels like "no space" but `df -h` shows free GB.

Zshunix
df -h

Same `/bin/df`. macOS `df` is BSD-derived — `-h` works the same; `-H` uses 1000-based units (SI) instead of 1024-based (`-h` "binary" units). Linux `df --output=source,size,used,avail` selects columns; BSD `df` lacks `--output`.

Fishunix
df -h

Same external. Fish has no built-in disk-info command. For just one filesystem: `df -h /` (root) or `df -h "$HOME"` (home volume). Repeated invocations are cheap — `df` reads kernel mount tables, not the disks themselves.

PowerShellwindows
Get-PSDrive -PSProvider FileSystem

Native cmdlet — lists every filesystem PSDrive with `Used` and `Free` columns in bytes. For human-readable output: `Get-PSDrive -PSProvider FileSystem | Select Name,@{n="Free(GB)";e={[math]::Round($_.Free/1GB,1)}}`. The richer `Get-Volume` (PS 5+, Windows-only) exposes filesystem type, drive type, and health status.

cmd.exewindows
wmic logicaldisk get caption,freespace,size

`wmic` is DEPRECATED in Windows 11 22H2+ but still ships. Modern replacement: `powershell -c "Get-Volume"`. cmd has no native equivalent of Unix-style mountpoint reporting — Windows volumes are usually drive-letter rooted, not mountpoint-rooted.

Worked examples

Show free space in human-readable units

Bash
df -h
PowerShell
Get-PSDrive -PSProvider FileSystem | Format-Table Name, @{n="Used(GB)";e={[math]::Round($_.Used/1GB,1)}}, @{n="Free(GB)";e={[math]::Round($_.Free/1GB,1)}}
cmd.exe
wmic logicaldisk get caption,freespace,size

Show inode usage (NOT block usage)

Bash
df -i
Zsh
df -i

Show free space for just the volume containing $HOME

Bash
df -h "$HOME"
PowerShell
(Get-PSDrive (Get-Item $HOME).PSDrive.Name).Free

Gotchas

  • GNU `df -h` uses 1024-based units (KiB/MiB/GiB); GNU `df -H` uses 1000-based units (KB/MB/GB) per SI. macOS BSD `df` defaults to 512-byte blocks WITHOUT `-h` — `df /` showing "488555536" is half-kilobytes, not kilobytes. Always pass `-h` for human reading.
  • ZFS and btrfs report Copy-on-Write snapshots as part of "used" — a `df -h` showing a near-full pool may have plenty of "unused" data trapped in snapshots. `zfs list -t snapshot` (ZFS) or `btrfs filesystem df` (btrfs) shows the real picture. On Linux ext4 / xfs this is a non-issue.
  • Running out of inodes shows up as `No space left on device` errors even when `df -h` reports plenty of free space. Always check `df -i` when "disk full" errors happen on a filesystem with millions of small files (e.g. mail spools, NPM caches).
  • WSL `/mnt/c` `df` reports the underlying NTFS volume sizing through the DrvFs adapter — which sometimes shows wrong totals on dynamic-VHD disks or storage spaces. For reliable Windows-side numbers run `Get-Volume` from PowerShell, not `df` from WSL.
  • Network filesystems (NFS, SMB, sshfs, GCS FUSE) may return STALE or BOGUS sizes — some report 16 EiB total (the maximum unsigned 64-bit byte count) when the server cannot compute a real size. Don't trigger alerts off `df` against network mounts without a sanity check.

WSL & PowerShell Core notes

pwsh`Get-PSDrive -PSProvider FileSystem` and `Get-Volume` are the canonical Windows equivalents. On Linux/macOS pwsh, `Get-PSDrive` still works but exposes a more limited view than the system `df`. For portable scripts, prefer `df -h` invoked via `bash -c` on Unix and `Get-Volume` on Windows — and feature-detect rather than assuming one or the other.
WSLInside WSL `df -h` shows BOTH the Linux root (`/`, on the ext4 VHD) AND `/mnt/c`, `/mnt/d` (drvfs mounts of the Windows drives). Sizes for `/mnt/*` come from the Windows volume metadata via 9P — slightly stale because WSL caches it for a few seconds, and incorrect for paths that span junction points or symlinks into other volumes.

Common tasks using df

Related commands