[NBLUG/talk] Disk cleanup

Kyle Rankin kyle at nblug.org
Tue Jan 27 16:37:01 PST 2004


On Tue, Jan 27, 2004 at 04:29:25PM -0800, Rick wrote:
> I'm trying to clear up some space on my disk drives.
> The bash find command works great for locating the largest files on the
> drives.
> I would also like to identify directories that contain large numbers of
> files, preferably by adding up all their storage requirements, then
> listing them as done by the find command.  Is there a bash command to
> accomplish this task?
> Any suggestions?
> 
> Thanks,
> Rick
> 

What I usually do is:

du -cb | sort -n

That will list and sort the directories and their sizes.

If you want to not span filesystems, add the -x option, so for instance, if
you just wanted to see / but not filesystems mounted under /:

cd /; du -x -cb | sort -n

If you want to see only a summary of the directories under the current one
(without knowing which directories under that take up the most space) use

du -sb * | sort -n

instead.

And of course, you can redirect the output to a file somewhere if you want
to read it easier :)

-- 
Kyle Rankin
NBLUG President
The North Bay Linux Users Group
http://nblug.org
IRC: greenfly at irc.freenode.net #nblug 
kyle at nblug.org



More information about the talk mailing list