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

Re: ls sorting order change



On 2012-05-01 21:10 +0200, Dan B. wrote:

> What controls the order that the ls command uses for sorting names?

The locale or more specifically, the LC_COLLATE setting.  See locale(7).

> On a fresh Squeeze installation, ls seems to ignore leading "."
> characters (it no longer lists all "hidden" files adjacent to each
> other) and to ignore capitalization differences.
>
> It used to sort in standard/traditional Unix order (not ignoring any
> characters, and ordering by order of characters in ASCII/etc. (as
> opposed to by case-insensitive alphabetical order)).

This behavior is not new, but your locale settings may be.

> What controls ls's sorting order?
>
> I haven't set any locale environment variable specifically for the
> collation order, but I don't know what base LANG=en_US.UTF-8 setting
> does.  Does "en_US" imply that new sorting order?

Yes.  Unless you override it with a different LC_COLLATE setting, that
is.

> How do I tell ls to work the way I've seen it work for decades?

I've been using LC_COLLATE=C for many years.

Cheers,
       Sven


Reply to: