Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 17 Dec 2007 12:08:21 -0500
From:      Jerry McAllister <jerrymc@msu.edu>
To:        DAve <dave.list@pixelhammer.com>
Cc:        freebsd-questions@freebsd.org
Subject:   Re: How to know total number of bytes of a directory
Message-ID:  <20071217170821.GD35443@gizmo.acns.msu.edu>
In-Reply-To: <47668320.5000706@pixelhammer.com>
References:  <32989.217.114.136.135.1197898685.squirrel@mail.dsa.es> <47667E61.70602@gmail.com> <47668320.5000706@pixelhammer.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Mon, Dec 17, 2007 at 09:09:36AM -0500, DAve wrote:

> Andy Greenwood wrote:
> > DSA - JCR wrote:
> >> Hi all
> >>
> >> I would like to know the total number of bytes of a directory and its
> >> related subdirs, occupied by the files inside it. I haven't found any
> >> command for knowning it.
> >>   
> > 
> > # du -s /etc
> > 17008   /etc
> > 
> > You need read privs to all the subdirectories, otherwise you'll get
> > permission errors and it'll skip those. Note that this displays usage in
> > 512-byte blocks, not bytes, but you should be able to figure it out from
> > there.
> 
> -h provides human readable output.
> du -sh /etc
> 3.8M    /etc

True, although for quickly scanning a long list of files and directories, 
it is more human readable to make them all have the same multiplyer rather
than having to read  the trailing m, k, g  etc.    
So,   I often use   'du -sk *' which makes eyeballing a list easier.

But, since the OP specifically said 'a directory' then -h is probably
the best idea, unless the OP wants the exact number of bytes.

////jerry


> 
> DAve
> 
> -- 
> Google finally, after 7 years, provided a logo for
> veterans. Thank you Google. What to do with my signature now?
> _______________________________________________
> freebsd-questions@freebsd.org mailing list
> http://lists.freebsd.org/mailman/listinfo/freebsd-questions
> To unsubscribe, send any mail to "freebsd-questions-unsubscribe@freebsd.org"



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