Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 9 Jan 2002 01:14:04 +0200
From:      Giorgos Keramidas <keramida@ceid.upatras.gr>
To:        Anthony Atkielski <anthony@atkielski.com>
Cc:        questions@freebsd.org
Subject:   Re: How do I find major consumers of disk space on the system?
Message-ID:  <20020108231404.GA77687@hades.hell.gr>
In-Reply-To: <008301c17af1$910f4a90$0a00000a@atkielski.com>
References:  <008301c17af1$910f4a90$0a00000a@atkielski.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On 2001-12-02 06:24:01, Anthony Atkielski wrote:
> I see that there are lots of commands that tell me various things about the
> filesystems I have mounted and what is on them, but what is the best command or
> commands to use in order to locate the parts of the file hierarchy that are
> taking up the most disk space?  For example, I have 1.3 GB in use on the /usr
> filesystem; how can I find out which directories are using the most space
> (mainly with an eye to deleting stuff that doesn't really need to be there)?

Since nobody else seems to have replied (or I missed the reply),
here's a hint:

	# du -sk bin lib
	11586   bin
	39664   lib

With du(1) and the -s option (only print the sum, and not every
subdirectory), you can use the following commands to find where under
/usr your space has gone.

	# cd /usr
	# du -sk *

This will show only the first level of /usr subdirs.  If you want to
see second level directories too, you can use either:

	# cd /usr
	# du -sk * */* | sort

or do other combinations of du/find/grep/sort like for example:

	# echo * */* | xargs file | grep 'directory$' | sed -e 's/:.*$//' | xargs du -sk | sort | more

(Note: This might take a while to finish.)

- Giorgos


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-questions" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20020108231404.GA77687>