Show Folder Sizes Sorted with du -sh

Rank every folder by disk usage, biggest last, in human-readable units.

macOSFilesdiskLow risk
Run du -sh */ | sort -h to list each folder's size from smallest to largest.

01Command

Command
$ du -sh */ | sort -h

02What it does

du -sh * alone lists sizes but in arbitrary order; piping through sort -h understands the K/M/G suffixes so the giant folder lands at the bottom. Note that folders you lack permission to read report zeros — re-run with sudo for the true total. For just the top offender, add | tail -5.

03Risk

RiskLow risk
!Warning: First run on a huge folder can take a while; the sizes also include hidden files that Finder ignores.

04Undo

✓No undo needed — this command does not change persistent state.

05Sources

  • du – Estimate file space usage
    ss64.com · technical · 2026-09-17
    Evidence: du -sh gives a human-readable total per argument; sort -h sorts those sizes correctly (2K < 1M < 3G).

Last verified: 2026-09-18 · Category: Files & Folders

06Related solutions