How to know total number of bytes of a directory

Ivan Voras ivoras at freebsd.org
Mon Dec 17 06:04:49 PST 2007


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.

Just add "-h":

# du -sh /etc
2.1M    /etc

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 194 bytes
Desc: OpenPGP digital signature
Url : http://lists.freebsd.org/pipermail/freebsd-questions/attachments/20071217/e6d624d0/signature.pgp


More information about the freebsd-questions mailing list