[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: "du -k" and "du -b" inconsistent output
From: |
Pádraig Brady |
Subject: |
Re: "du -k" and "du -b" inconsistent output |
Date: |
Fri, 20 Oct 2006 10:07:48 +0100 |
User-agent: |
Mozilla Thunderbird 1.0.8 (X11/20060502) |
Miguel Barão wrote:
> This not a bug but rather an inconsistent output between these two du
> options,
> which is not documented in the manpages.
>
> Suppose 'somefile' is a file containing a lot of zeros.
>
> Then I get:
> $ du -k somefile
> 12
> $ du somefile
> 12
> $ du -b somefile
> 4194432
>
> It seems that du -b is returning the size of the file, and not the "disk
> usage" of that file.
Yes, as that is what is usually required.
This is documented at least since 5.2.1 in the man page (--help output)
du -b ≡ du --apparent-size --block-size=1
you want to use
du --block-size=1
Pádraig.