Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 17 Dec 2007 09:31:43 -0500
From:      Andy Greenwood <greenwood.andy@gmail.com>
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:  <4766884F.2070809@gmail.com>
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
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
>
> DAve
>
>   

Ahh, I had forgotten about -h. I ususally use du -s * | sort -rn  | head 
to find the biggest files/directories in a given directory, and if you 
use -h, you'll get stuff out of order, since 3.8M will come after 4.2K 
in a reversed numerical sort.




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