Is there a way in Unix to see the biggest directories on disk?
I need to know why I'm almost out of space on the server,= and I don't know where most of the space is used.
Server Fault is a question and answer site for system and network administrators. It only takes a minute to sign up.Sign up to join this community
My favorite tool for this task is ncdu.
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.
I parse through each folder level, to find the root of the problem, like this:
du -h --max-depth=1 -t 1G /Dir0/Dir1 | sort -n | tail -10
du -h --max-depth=1 -t 1G /Dir0/Dir1/biggestFolderInDir1 | sort -n | tail -10
-h: human readable sizes
-t 1G: only list directories bigger than 1G
sort -n: sort numerically (2G will be considered bigger than 1T)
tail -10: only list the last (biggest) 10 items
I'm regularly running
du -dak > du-dak.out at the top of each file system. Then, I can get a graphical display with
xdu < du-dak.out. This can be done remotely after transferring the du-dak.out file over the network should you only have text access.