[NTLUG:Discuss] Re: Is there a command line utility which will report directory statistics?

Kevin Brannen kbrannen at pwhome.com
Fri Jan 20 12:02:01 CST 2006


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




More information about the Discuss mailing list