Web lists-archives.com

Re: ls -la sort order




On Wed, Oct 03, 2018 at 01:51:54PM -0400, Lee wrote:
> 
> Sure - I can understand some people wanting A a to sort together.  But
> ignoring non-alpha characters when sorting???  Eventually I'm sure I
> can get used to
>   Music
>   old
>   Pictures
> 
> but this order is obnoxious
>   .mozilla
>   Music
>   old
>   Pictures
>   .profile
>   Public
> 

While it may not particularly intuitive, I would not call it obnoxious.
In English, the '.' would not customarily be used to make lexical
sorting decisions.

Dr. Jiles
Dr Jones
Dr. Jurgenson

That would be the sort order I expect (for English, or most any other
natural language locale).

Either of

Dr Jones
Dr. Jiles
Dr. Jurgenson

or

Dr. Jiles
Dr. Jurgenson
Dr Jones

would seem incorrect to me.  I suspect that collation function has no
way of knowing whether the punctuation is important or not, so it must
adhere to the rules specified in the locale (to ignore it in this case).
You could always write a custom locale that sorts punctuation before or
after letters, as you like.  The locale(5) man page would be a good
place to start for that.

> I don't think I'll ever get used to that.  I'm just a bit concerned
> that setting LC_COLLATE=C is going to break something & I'll have a
> heck of a time figuring out it was because I changed the sort order.
> 

Call me old school, but I have LC_COLLATE=C in every shell profile on
every machine that I use.  I find that sorting is most important to me
at the shell prompt (and usually when using ls).  There has never been
instance where I encountered an oddity that I even suspected related to
my choice of LC_COLLATE.

Regards,

-Roberto

-- 
Roberto C. Sánchez