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

Find the directories consuming the most hard drive space within:

Whole hard drive

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

Home directory

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

Graphical method

“ncdu” is a graphical Ncurses based program showing the largest files. NCDU is more user-friendly than the plain text method above. NCDU allows deleting files interactively.

Linux / Windows Subsystem for Linux

apt install ncdu

When using on WSL, specify the desired drive like (for C: in this example):

ncdu /mnt/c

MacOS

brew install ncdu

Windows Cygwin

setup-x86_64 -P ncdu