|
From: | Paul Eggert |
Subject: | bug#49994: upgrade: have "-s" of 'ls' display alloc'd sizes for specified "--block-size" |
Date: | Fri, 20 Aug 2021 08:08:13 -0700 |
User-agent: | Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.11.0 |
On 8/20/21 12:02 AM, L A Walsh wrote:
When I use "-b" in du (equivalent to '--apparent-size --block-size=1)
Previously in this thread you asked for "allocated space for a file on a device", which is why I was talking about that number.
Now you're asking for apparent size, which is a different number. If you want apparent size, you can use 'ls -l', or follow Andreas's suggestion and use something like 'stat -c "%s %n"'. However, apparent size might be quite different from allocated space, as can be seen in the 1st and 6th columns of the last two lines of the following:
$ echo '' >a $ truncate -s 1TB b; echo '' >>b $ ls -ls --block-size=1 a b 4096 -rw-rw-r-- 1 eggert eggert 1 Aug 20 08:07 a 4096 -rw-rw-r-- 1 eggert eggert 1000000000001 Aug 20 08:07 b
[Prev in Thread] | Current Thread | [Next in Thread] |