4

Possible Duplicate:
How to understand what's taking up space?

What's a good command line utility/script to analyze a folder structure and find out what's taking up all the space? The granularity of df is way to large.

Specifically I'd like something that can run with limited permissions (e.g. on shared hosting) I seem to be running on Redhat, if that matters.

ripper234
  • 31,763

1 Answers1

5

It's not a treemap (which I agree can be nice), but du will give you a breakdown by directory. Look into the -d option, to only show a certain level of depth.

Also note that you can sort the output, but you should use -k or similar, otherwise '1M' will sort before '2K' - probably not what you want.

Example: show size summary for all directories in current directory:

du -d 1 .
jwd
  • 1,467
  • 3
    If you haven't seen ncdu you should check it out as it is even better for large scans where you wish to be able to drill down: http://unix.stackexchange.com/a/3964/13779 – Gerry May 22 '16 at 16:36
  • Use sort -h for "human-numeric sort", then it will get M, G etc right. du -h | sort -h – Åsmund Jan 19 '24 at 08:24