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

Find the directories consuming the most hard drive space with

Whole hard drive:

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

Home directory:

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

This works on

  • Linux
  • MacOS
  • Windows (using Cygwin or Windows Subsystem for Linux)
  • BSD

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
  • MacOS brew install ncdu
  • Windows Cygwin setup-x86_64 -P ncdu
  • BSD pkg install ncdu

Leave a Comment