How to know total number of bytes of a directory

DAve dave.list at pixelhammer.com
Mon Dec 17 06:09:45 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.

-h provides human readable output.
du -sh /etc
3.8M    /etc

DAve

-- 
Google finally, after 7 years, provided a logo for
veterans. Thank you Google. What to do with my signature now?


More information about the freebsd-questions mailing list