Subject: Re: bug#14525: ls -k produced no size, ls -lk lists in bytes? What's up w/k?

From: Eric Blake <[email-masked]>
Date: Sat, 01 Jun 2013 18:34:06 -0600

On 06/01/2013 03:54 PM, Linda Walsh wrote:
> I know the "-h" displays sizes using variable units,
> but if I want to have it display all of the sizes in terms
> of 'K' or 'M' or (not likely useful, but 'G' or 'T'), how
> do I do it?

'ls --block-size=1k' or 'ls --block-size=1M'

> If 'k' doesn't have it, does posix mandate that the user can't
> choose what unit to display things in?

POSIX can only mandate what portable uses are limited to.  You are
correct that there is no portable way, via POSIX options alone, to make
ls change what units it displays in, other than what POSIX requires of
'-k' (which affects only the -s column and the per-directory summary).
But POSIX does not (and cannot) mandate against extensions, and we have
not removed any of coreutils' extensions - we merely removed -k as a
synonym of the extension --block-size=..., because the POSIX
specification of -k is incompatible with the --block-size= extension
semantics that we did not change.  If you think there is an extension
missing in ls to display something that you need, feel free to write a
patch to provide that extension - we have long desired to have a
--format option that would let you choose which pieces of information to
display and in what order.

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org