Paging Matthew Seaman

Matthew Seaman m.seaman at infracaninophile.co.uk
Fri Jan 4 09:18:59 PST 2008


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

Paul Schmehl wrote:
> I figure if anyone knows the answer to this off the top of their head,
> Matthew will.

Fame at last!

> I've been reading the man pages for du and df, but I can't find the
> right combination.  I'd like to get the type of output that df -h gives
> you but only for one mount point or even one directory.  Is there a tool
> that can do that? (IOW, I'd like to run du -h but only get the totals
> for directories.)

Well, for a mount point, the command that will give you output like
'df -h' for a specific partition is (*ta da*) 'df -h' -- tell it a
file or directory and it will tell you all about the partition that
lives on:

% df -h /tmp
Filesystem    Size    Used   Avail Capacity  Mounted on
/dev/md0      248M     22K    228M     0%    /tmp

For an arbitrary directory, I assume you want the du(1) style total
space usage figures but in the 'human readable' style?  'du -hs' does
that if you tell it the directory name:

% du -hs /tmp
 22K    /tmp

As others have suggested else thread, there are a variety of cunning
find + xargs combinations for generating a list of directories and
feeding the list into du(1) automatically.

But all this seems to me to be pretty clearly explained in the du(1)
and df(1) man pages so I've probably completely misunderstood what you
are actually asking for. 

	Cheers,

	Matthew

- -- 
Dr Matthew J Seaman MA, D.Phil.                   7 Priory Courtyard
                                                  Flat 3
PGP: http://www.infracaninophile.co.uk/pgpkey     Ramsgate
                                                  Kent, CT11 9PW
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.4 (FreeBSD)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFHfmp78Mjk52CukIwRCBFOAJ4gMFtchgMczC9V8/MwpXrs00+L6QCfYwrU
R8Kev8R9wg2gkbJsZCuCxwg=
=djh7
-----END PGP SIGNATURE-----


More information about the freebsd-questions mailing list