[Techtalk] Need tool to find where 400 mb of stuff is hidden

Mary mary-linuxchix at puzzling.org
Sat Feb 4 12:01:28 EST 2006


On Fri, Feb 03, 2006, Lucky Lady wrote:
> I need to find out which of my many sub directories in /var contain
> over 400 mb of stuff. I want a tool that will automatically tell me
> the space used in each sub directory in /var. 

This tool is "du". In normal usage, "du" will actually sum
subdirectories, so for example consider this output:

$ du
108     ./lib/defoma/gs.d/dirs/fonts
4       ./lib/defoma/gs.d/dirs/CMap
116     ./lib/defoma/gs.d/dirs
232     ./lib/defoma/gs.d

This doesn't mean that there's separately 232 KB in ./lib/defoma/gs.d,
it means that there's 232 KB in ./lib/defoma/gs.d *and* all its
subdirectories.

However, if you pass it the -S flag, it will sum directories separately:

$ du -S
108     ./lib/defoma/gs.d/dirs/fonts
4       ./lib/defoma/gs.d/dirs/CMap
4       ./lib/defoma/gs.d/dirs
116     ./lib/defoma/gs.d

"du -S" is probably what you want. You can sort the output numerically
("sort -n") so that all the big directories will be at the end:

$ du -S | sort -n
4       ./lib/defoma/gs.d/dirs
4       ./lib/defoma/gs.d/dirs/CMap
108     ./lib/defoma/gs.d/dirs/fonts
116     ./lib/defoma/gs.d

Once you've found them, you obviously *may* not wish just to delete
things that you don't understand: that's a good way to trash your
system. Feel free to ask here what things do if you don't know.

-Mary


More information about the Techtalk mailing list