Dan B. wrote:
> What controls the order that the ls command uses for sorting names?
LC_COLLATE. Set it to "C".
--
John Hasler
--
To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
Archive: 87397jo8fc.fsf@thumper.dhh.gt.org">http://lists.debian.org/87397jo8fc.fsf@thumper.dhh.gt.org
05-02-2012, 12:57 AM
Wayne Topa
ls sorting order change
On 05/01/2012 03:10 PM, Dan B. wrote:
What controls the order that the ls command uses for sorting names?
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)).
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?
How do I tell ls to work the way I've seen it work for decades?
Well man ls says
" List information about the FILEs (the current directory by default).
Sort entries alphabetically if none of -cftuvSUX nor --sort is specified."
Guess you could start there.
Hope this helps
Wayne
--
To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
>
> 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.
Hi Daniel,
To list the hidden files, use the -a or -A option (the latter omits
. and ..). Maybe you had one of these in an alias on a previous
system?
Alternatively, if you want to see hidden files when you type "ls *"
you can set "shopt -s dotglob" (this is specific to bash).
--
Cheers,
Clive
--
To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
Archive: 20120502082050.GA4827@rimmer.localdomain">http://lists.debian.org/20120502082050.GA4827@rimmer.localdomain
05-02-2012, 03:02 PM
Camaleón
ls sorting order change
On Tue, 01 May 2012 15:10:23 -0400, Dan B. wrote:
> What controls the order that the ls command uses for sorting names?
>From "man ls" → info coreutils 'ls invocation' anf here it can be read:
***
By default, the output is sorted alphabetically, according to the
locale settings in effect.(1) If standard output is a terminal, the
output is in columns (sorted vertically) and control characters are
output as question marks; otherwise, the output is listed one per line
and control characters are output as-is.
(1) If you use a non-POSIX locale (e.g., by setting `LC_ALL' to
`en_US'), then `ls' may produce output that is sorted differently than
you're accustomed to. In that case, set the `LC_ALL' environment
variable to `C'.
***
Depending on the version you're using this can vary.
> 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.
(...)
Can you post a sample of the command you issued and the ouput you got?
Greetings,
--
Camaleón
--
To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
Archive: jnri98$iv6$4@dough.gmane.org">http://lists.debian.org/jnri98$iv6$4@dough.gmane.org
05-02-2012, 07:07 PM
"Dan B."
ls sorting order change
Wayne Topa wrote:
On 05/01/2012 03:10 PM, Dan B. wrote:
What controls the order that the ls command uses for sorting names?
...
...
Well man ls says
" List information about the FILEs (the current directory by default).
Sort entries alphabetically if none of -cftuvSUX nor --sort is specified."
Guess you could start there.
Yes, I did look at the manual page and saw that text. However, that
didn't say anything about which definition of "alphabetical" ls uses.
Daniel
--
To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
On Tue, 01 May 2012 15:10:23 -0400, Dan B. wrote:
...
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.
(...)
Can you post a sample of the command you issued and the ouput you got?
It was like (using made-up names):
.aaa
bbb
ccc
DDD
EEE
.fff
when I expected:
.aaa
.fff
DDD
EEE
bbb
ccc
(The first order is a typical order for English (case-insensitive, and
ignoring punctuation), so now it makes sense that my default locale
setting (LANG=en_US.UTF-8) yielded that order.
The second order is plain old ASCII(/ISO-8859-x/Unicode) character
order with no special treatment (ignoring or case-mapping) of
characters--and setting LC_ALL=C (or LC_COLLATE=C) does indeed yield that
order.
I guess now I need to figure out where I might like to see things in
the "new" order vs. where I still want to see things in LC_COLLATE=C
order.)
Daniel
--
To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
> Camaleón wrote:
>> On Tue, 01 May 2012 15:10:23 -0400, Dan B. wrote: ...
>>
>>> 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.
>>
>> (...)
>>
>> Can you post a sample of the command you issued and the ouput you got?
>
> It was like (using made-up names):
>
> .aaa
> bbb
> ccc
> DDD
> EEE
> .fff
>
> when I expected:
>
> .aaa
> .fff
> DDD
> EEE
> bbb
> ccc
sm01@stt008:~/Desktop/test$ ls -la
total 1
drwxr-xr-x 2 sm01 sm01 192 may 3 18:33 .
drwxr-xr-x 10 sm01 sm01 816 may 3 18:32 ..
-rw-r--r-- 1 sm01 sm01 0 may 3 18:32 .aaa
-rw-r--r-- 1 sm01 sm01 0 may 3 18:32 bbb
-rw-r--r-- 1 sm01 sm01 0 may 3 18:32 ccc
-rw-r--r-- 1 sm01 sm01 0 may 3 18:33 DDD
-rw-r--r-- 1 sm01 sm01 0 may 3 18:33 EEE
-rw-r--r-- 1 sm01 sm01 0 may 3 18:33 .fff
While changing the locale:
sm01@stt008:~/Desktop/test$ LANG=C ls -la
total 1
drwxr-xr-x 2 sm01 sm01 192 May 3 18:33 .
drwxr-xr-x 10 sm01 sm01 816 May 3 18:43 ..
-rw-r--r-- 1 sm01 sm01 0 May 3 18:32 .aaa
-rw-r--r-- 1 sm01 sm01 0 May 3 18:33 .fff
-rw-r--r-- 1 sm01 sm01 0 May 3 18:33 DDD
-rw-r--r-- 1 sm01 sm01 0 May 3 18:33 EEE
-rw-r--r-- 1 sm01 sm01 0 May 3 18:32 bbb
-rw-r--r-- 1 sm01 sm01 0 May 3 18:32 ccc
> I guess now I need to figure out where I might like to see things in the
> "new" order vs. where I still want to see things in LC_COLLATE=C order.)
Is that "that new"? The above output is from my Lenny system and that was
the default setup two years ago :-?
Greetings,
--
Camaleón
--
To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
Archive: jnuctq$78r$7@dough.gmane.org">http://lists.debian.org/jnuctq$78r$7@dough.gmane.org
05-03-2012, 05:26 PM
"Dan B."
ls sorting order change
Camaleón wrote:
On Wed, 02 May 2012 15:28:33 -0400, Dan B. wrote:
...
I guess now I need to figure out where I might like to see things in the
"new" order vs. where I still want to see things in LC_COLLATE=C order.)
Is that "that new"? The above output is from my Lenny system and that was
the default setup two years ago :-?
No, it's not really that new--just new to me because I got far behind
in upgrading/updating my Debian system. (That's why I used quotes--to
show that I didn't really mean the usual sense of new.)
Daniel
--
To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org