🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.unix.shell
Article #219

Re: Changing collation order with 'ls'

#219
From: Christian Weisgerber
Date: Wed, 14 Oct 2026 11:42
31 lines
1795 bytes
On 2026-10-14, Janis Papanagnou <janis_papanagnou+ng@hotmail.com> wrote:

> I looked into the mundane appearing question to change the sorting
> order of the 'ls' command. I wanted to have non-'alnum' characters
> come first. The two obvious ways - looking into the (many dozens!)
> of options supported by 'ls', and setting LC_COLLATE (or LC_ALL) -
> strangely, didn't work or show anything appropriate.

That would depend on the operating system's ls(1) implementation,
but FreeBSD's does honor LC_COLLATE:

$ locale
LANG=C.UTF-8
LC_CTYPE="C.UTF-8"
LC_COLLATE="C.UTF-8"
LC_TIME="C.UTF-8"
LC_NUMERIC="C.UTF-8"
LC_MONETARY="C.UTF-8"
LC_MESSAGES="C.UTF-8"
LC_ALL=
$ touch i I ı İ
$ ls
I       i       İ      ı
$ LC_COLLATE=tr_TR.UTF-8 ls
ı      I       i       İ

The sysadmin would have to create a locale with your particular
collation order.

-- 
Christian "naddy" Weisgerber                          naddy@mips.inka.de
Technical Details
Message-ID: <slrn11cuqkl.dq6.naddy@lorvorc.mips.inka.de>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!news.szaf.org!inka.de!mips.inka.de!.POSTED.localhost!not-for-mail
References: <11anebm$4o6l$4@dont-email.me>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!news.szaf.org!inka.de!mips.inka.de!.POSTED.localhost!not-for-mail
From: Christian Weisgerber <naddy@mips.inka.de>
Newsgroups: comp.unix.shell
Subject: Re: Changing collation order with 'ls'
Date: Wed, 14 Oct 2026 11:42:13 -0000 (UTC)
Message-ID: <slrn11cuqkl.dq6.naddy@lorvorc.mips.inka.de>
References: <11anebm$4o6l$4@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Injection-Date: Wed, 14 Oct 2026 11:42:13 -0000 (UTC)
Injection-Info: lorvorc.mips.inka.de; posting-host="localhost:::1";
	logging-data="14151"; mail-complaints-to="usenet@mips.inka.de"
User-Agent: slrn/pre1.0.4-9 (FreeBSD)