[NTLUG:Discuss] Re: Is there a command line utility which will report directory statistics?
Leroy Tennison
leroy_tennison at prodigy.net
Sat Jan 21 04:46:18 CST 2006
Kenneth Loafman wrote:
> What the Evil Empire does is give you a summation of how much space
> the files would occupy if they could be concatenated end to end. The
> du command gives you the actual amount of space the files occupy,
> including cluster tips. From an admin standpoint, that is much more
> useful.
>
> ...Ken
>
>
> Kevin Brannen wrote:
>
>> Leroy Tennison wrote:
>>
>>> ...
>>> Second, I take it that 'du' reports only in blocks rather than
>>> actual aggregates of sizes even if the '-b' switch is used,
>>> correct? The reason I ask is that I'm looking for an equivalent of
>>> what the Evil Empire does when it calculates directory sizes.
>>
>>
>>
>> Not sure what you're asking here, but -b gives you the size in bytes
>> (or changes the block size to 1 byte instead of the default 1K). Try
>> "du --help" and read closely. If you prefer to learn by example,
>> here's something for you:
>>
>> [13 ~ /home/kevin] ls -l SUSE-10.0-LiveDVD.iso
>> -rwx------ 1 kevin users 1094363136 2006-01-17 20:57
>> SUSE-10.0-LiveDVD.iso
>>
>> [14 ~ /home/kevin] du -b SUSE-10.0-LiveDVD.iso
>> 1094363136 SUSE-10.0-LiveDVD.iso
>>
>> [15 ~ /home/kevin] du -k SUSE-10.0-LiveDVD.iso
>> 1069760 SUSE-10.0-LiveDVD.iso
>>
>> [16 ~ /home/kevin] du -h SUSE-10.0-LiveDVD.iso
>> 1.1G SUSE-10.0-LiveDVD.iso
>>
>> So you can see the actual size with the "ls -l" and that "du -b"
>> gives the same answer (as would "wc -c"). The -k and -h switches to
>> du just change their reporting format. I used a file here to make
>> the example easier, but you would get the same type of results with
>> full dirs.
>>
>> HTH,
>> Kevin
>>
>> _______________________________________________
>> https://ntlug.org/mailman/listinfo/discuss
>>
>
>
> _______________________________________________
> https://ntlug.org/mailman/listinfo/discuss
>
I agree that, depending on what your goals are, the actual disk space
taken may be far more important. However, the situation that prompted
my question was one where I was wondering if I had ftp'ed all the source
files to the destination. A simple byte-count comparison would have
given me a Yes or No answer. Admittedly 'wc -l' is another wayt to
accomplish the same thing in this situation.
More information about the Discuss
mailing list