🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.unix.shell
Article #218

Changing collation order with 'ls'

#218
From: Janis Papanagnou
Date: Wed, 14 Oct 2026 08:26
26 lines
2393 bytes
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.

According to the results of a search on the Net there isn't any
straightforward way to achieve that - and this I think is really
astonishing! - and the only _functional_ suggestion I found was to
explicitly enumerate the files with shell patterns like  ls _* [!_]*
(here for the underscore case, which was my concern; handling all
non-alnum characters would make that pattern even worse). Needless
to say that patterns don't solve the requirement generally since
that approach conflicts with regular use of patterns with 'ls'.[*]

Can that be true, or is there some solution to change the sorting
order [on the shell command-line level] that I'm missing?

Janis

PS: I seem to recall that in former times I've seen filenames shown
listed with non-alnum characters come first or last, but my memories
might be wrong here.

[*] In the sense that I cannot alias once and for all the 'ls'.
Technical Details
Message-ID: <11anebm$4o6l$4@dont-email.me>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!eternal-september.org!feeder.eternal-september.org!nntp.eternal-september.org!.POSTED!not-for-mail

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!eternal-september.org!feeder.eternal-september.org!nntp.eternal-september.org!.POSTED!not-for-mail
From: Janis Papanagnou <janis_papanagnou+ng@hotmail.com>
Newsgroups: comp.unix.shell
Subject: Changing collation order with 'ls'
Date: Wed, 14 Oct 2026 10:26:30 +0200
Organization: A noiseless patient Spider
Lines: 26
Message-ID: <11anebm$4o6l$4@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Wed, 14 Oct 2026 08:26:31 +0000 (UTC)
Injection-Info: dont-email.me;
	logging-data="155861"; mail-complaints-to="abuse@eternal-september.org";	posting-account="U2FsdGVkX1/D0XB8SMkdfg/iZly4oeo/"; posting-host="359384faa59b45467a45ee36976f8a6e"
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:kISK51IbTnz4LiljjYFz/QfSHPc= sha256:1WBgMr1TQczoGmAQGa653gQMukb8jVm4/uU83nQBUxs=
	sha1:IPLhnbYKWX+s12Bbh7QRiG8RPVc= sha256:sSBxnkiTVfMGWPZtE9ij1FDAHWMw7cMaKl8+uKeqNaI=
Content-Language: en-US