NetBSD-Users archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: How to use the 'ls' -M flag?



Using RVP's recipes -- success!

Thank you very much, and d'oh, of course it makes sense that the default C/POSIX locale is "" -- the most 'reasonable' default.

p.s. yes, I used  "ls -lM"  not just the -M flag.   You need -l otherwise -M by itself is a no-op.


On Fri, May 26, 2023 at 11:50 PM RVP <rvp%sdf.org@localhost> wrote:
On Fri, 26 May 2023, Michael Cheponis wrote:

> I'm having no success trying to get ls to print file sizes, using the -M
> flag.
>

The `thousands separator' char. is locale-specific. In the default C/POSIX
locale, it is "":

$ locale -c thousands_sep
LC_NUMERIC
$ LC_NUMERIC=C locale -c thousands_sep
thousands_sep=""
$ LC_NUMERIC=en_US.UTF-8 locale -k thousands_sep
thousands_sep=","
$ LC_NUMERIC=en_US.UTF-8 ls -lM /netbsd.GENERIC
-rwxr-xr-x  1 root  wheel  29,529,152 May 24 13:09 /netbsd.GENERIC
$

Set some locale in ~/.profile (or ~/.xinitrc, ~/.xsession, ...). Eg.:

export LANG=en_GB.UTF-8
export LC_CTYPE=$LANG
export LC_ALL=""

-RVP


Home | Main Index | Thread Index | Old Index