Find largest directories on Linux, Mac, Windows and BSD.

Find the directories consuming the most hard drive space within each category:

Whole hard drive

du -hd1 / 2>/dev/null | sort -rh | head

Home directory

du -hd1 ~ 2>/dev/null | sort -rh | head

This works on

Graphical Ncurses

ncdu is a graphical Ncurses based program showing the largest files, I prefer it to the plain text method above.

  • Linux / Windows Subsystem for Linux

    apt install ncdu

    When using on WSL, specify the desired drive like

    ncdu /mnt/c

    for c:\

  • MacOS

    brew install ncdu
  • Windows Cygwin

    setup-x86_64 -P ncdu