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.

3
  • 2
    Er...didn't you ask this a year ago? Nov 10, 2011 at 20:30
  • 1
    @MichaelMrozek - I vaguely remembered something like that. Now next time I'll be able to find one of these questions. Sorry for not looking too hard, I was in the "fire question away" mood.
    – ripper234
    Nov 10, 2011 at 21:23
  • ncdu ncdu ncdu ncdu
    – user84207
    May 17, 2023 at 19:58

1 Answer 1

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 .
2
  • 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: unix.stackexchange.com/a/3964/13779
    – Gerry
    May 22, 2016 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 at 8:24

Not the answer you're looking for? Browse other questions tagged .