Skip to content
shellmap

Check free disk space

Show free and used space per filesystem (or per drive) in a human-readable form.

How to check free disk space in each shell

Bashunix
df -h

`-h` = human-readable (KB/MB/GB/TB with binary 1024 base on GNU, base-10 on `-H`). `-T` adds filesystem type. `-i` reports inodes instead of bytes (useful when `df -h` shows 50% free but writes fail — you ran out of inodes, not bytes).

Zshunix
df -h

Same external `df`. macOS BSD `df -h` uses base-2 GiB; `df -H` uses base-10 GB (the drive-marketing flavour). `df -hT` is GNU-only — BSD `df` has no `-T` (use `mount | grep` to see filesystem type).

Fishunix
df -h

Same external. To watch live: `watch -n 5 df -h` (Linux/macOS via `brew install watch`).

PowerShellwindows
Get-PSDrive -PSProvider FileSystem | Select-Object Name,@{N="UsedGB";E={[math]::Round($_.Used/1GB,1)}},@{N="FreeGB";E={[math]::Round($_.Free/1GB,1)}}

pwsh `Get-PSDrive` lists ALL drives (file, registry, alias, env) — `-PSProvider FileSystem` filters to disks. Sizes are bytes; `/1GB` divides by 1073741824 (binary GiB). For network drives include `Get-CimInstance Win32_LogicalDisk` instead — `Get-PSDrive` only sees drives PSDrive knows about.

cmd.exewindows
wmic logicaldisk get size,freespace,caption

`wmic` reports bytes — divide by `1073741824` for GiB. `wmic` is DEPRECATED on Windows 11 24H2+ — use `powershell -Command "Get-CimInstance Win32_LogicalDisk | Format-Table DeviceID,@{N='FreeGB';E={[math]::Round($_.FreeSpace/1GB,1)}},@{N='SizeGB';E={[math]::Round($_.Size/1GB,1)}}"`. The legacy `dir C:\` also shows free space on the last line.

Equivalents listed for Bash, Zsh, Fish, PowerShell, cmd.exe.

Gotchas & notes

  • **Bytes vs inodes**: `df -h` reports BYTES free. A filesystem can have 90% bytes free but 100% inodes used — small-file workloads (mail spool, build cache) eat inodes faster than bytes. `df -i` reports inodes. Symptom: writes fail with `ENOSPC` even though `df -h` looks healthy. ext4 fixes the inode count at mkfs time; XFS / Btrfs / APFS / NTFS allocate inodes dynamically (no separate exhaustion mode).
  • **Mount-point granularity**: `df` reports per-MOUNTED-FILESYSTEM. A single physical disk partitioned with separate `/`, `/home`, `/var` mounts shows as three lines. Conversely, a tmpfs / overlayfs / fuse mount shows as a line that may or may not reflect physical disk pressure. For physical-disk pressure, look at the device path (`/dev/sd*`, `/dev/nvme*`) lines, not tmpfs.
  • **Binary vs decimal units — `-h` vs `-H`**: GNU `df -h` uses 1 KiB = 1024 (computer-science binary); `df -H` uses 1 KB = 1000 (drive-vendor decimal). BSD `df -h` is the same convention. A 1 TB drive (1,000,000,000,000 bytes from the vendor) shows `931G` under `df -h` but `1.0T` under `df -H` — same drive, different unit base. Mismatch is the source of "where did my 70 GB go".
  • **pwsh GB vs GiB literal**: pwsh `1GB` literal is `1073741824` (binary GiB) — same convention as GNU `df -h`. There is no pwsh `1GiB` literal; the binary base is the default and is named `GB`. To report decimal GB, divide by `1000000000` explicitly.

Related commands

Related tasks