EzCool
09-16-2002, 10:06 PM
Is there any shell command that will list the largest directories in a directory? I've tried using du, but I haven't been able to get it to sort the data.
Is there any other way to do it?
chuckt101
09-17-2002, 08:13 AM
Originally posted by lpguitars
Will
ls -l -S
work?
I think he wants largest subdir contents as opposed to largest contents in the directory.
Other than writing a script to do it, i'm not sure if there is a command (or flags) to do that... :cartman:
spock
09-17-2002, 08:14 AM
You can use sort with a numerical sort flag to sort the output from du. A simple example would be
du -s * | sort -n
chuckt101
09-17-2002, 08:42 AM
woah sweet. thanks spock :D
although it lists 111 megs being bigger than 11 gigs :D
ah well...... numeric sort is better than none at all
dandanfirema
09-17-2002, 09:31 AM
I use this when tracking subdir size
du -h --max-depth=1
It tells you how big each of the subdirectories in the current directory are. I then go down one level and repeat until I have found out who or what is hogging my disk space.
spock
09-17-2002, 09:39 AM
Originally posted by aragon
woah sweet. thanks spock :D
although it lists 111 megs being bigger than 11 gigs :D
Well, you'll have to use the same unit for all directories in order for sort to work; sort can't handle "human-readable", so do not use the -h flag to du.