Re: Filesystem usage by Directory wise
- From: Kenan Kalajdzic <kenan@xxxxxxx>
- Date: Wed, 27 Sep 2006 06:06:12 +0000 (UTC)
balreddy.gattu@xxxxxxxxx wrote:
Hi All,
Iam working on sun solaris system. I am looking for a utility which
needs to display the size of each directory in the filesystem.
i.e The utility needs to display the total size of the filesystem and
the usage with each directory wise,
example:
/test filesystem
df -h will return the filesystem usage of /test.
But i want the usage like this:
/test
Total used %
2 TB 1TB 50%
Usage:
Directory name Usage %
/test/abc 0.25TB 12.5%
/test/xyz 0.5TB 25%
.................
You could start with
du -h /test
If the percentage column is not important, this may be sufficient.
Otherwise, you could try this little script:
#!/bin/sh
DIR=/test
TOTAL=`du -sk "$DIR" | sed 's/[^0-9].*//'`
( du -k "$DIR" ; du -h "$DIR" ) | sort +1 | awk '{
if ( $1 ~ /[^0-9]/ ) {
line = $0
getline
c = $1
} else {
c = $1
getline
line = $0
}
p = c * 100 / total
printf "%6.2f%%\t%s\n", p, line
}' total=$TOTAL
--
Kenan Kalajdzic
.
- References:
- Filesystem usage by Directory wise
- From: balreddy . gattu
- Filesystem usage by Directory wise
- Prev by Date: Re: Filesystem usage by Directory wise
- Next by Date: Re: How to get argv[0] in alias for bashrc
- Previous by thread: Re: Filesystem usage by Directory wise
- Next by thread: How to get argv[0] in alias for bashrc
- Index(es):
Relevant Pages
|