How can I find the biggest directories in unix / Ubuntu?

Solution 1:

Try: du --max-depth=7 /* | sort -n - it won't just tell you directories, and there will be duplicates, but it will list everything 7 levels deep and sort them by size order.

Solution 2:

My favorite tool for this task is ncdu.

ncdu example screen


Solution 3:

I suggest you to use baobab, which will give you a graphical overview of your disk usage. It can also be used for remote folder (through ssh, ftp,...) to scan the disk usage on a remote server for instance.

Edit: If you would like to investigate the disk usage directly on the server with your shell access and not remotely, and you would like a tool more convenient than du, you can also have a try with durep which will generate a report of the disk usage with bar graphs.


Solution 4:

I usually use something like this:

du -ch / | sort

You can apply a depth restriction using --max-depth= if you don't want to see past a certain level from your target, like so:

du -ch --max-depth=4 /

Tags:

Unix

Ubuntu