Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Sorting order for ls changed
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Other Things Gentoo
View previous topic :: View next topic  
Author Message
jbo5112
n00b
n00b


Joined: 16 Nov 2005
Posts: 19

PostPosted: Thu Apr 19, 2007 3:37 am    Post subject: Sorting order for ls changed Reply with quote

I recompiled my kernel (2.6.17 w/ reiser4 patch) with some different options set on nfs, and rebooted my machine from work. Now that I'm home, the command "ls" (aliased to "ls -F --color=auto") does a case insensitive sort on filenames. I tried "shopt -u nocaseglob" with no luck fixing it. This is driving me nuts, and I don't have the slightest clue what caused the change. I don't even know for sure how long it has been doing this.

I counted on the capital letters coming before the other letters, but now "main.cpp" comes before "Makefile" :( . I've already spent all week dealing trying to track down weird bugs in a computer program, and had weird problems with cygwin at work. Now I've got some strange setting that is messing with my 'ls'. It only happens when I open some sort of xterm (tried xterm, Eterm, aterm and konsole). It doesn't happen when I login from a virtual terminal on the console, or run "su -", or even run "su - <myaccount>" back from root.

This might have been covered somewhere by someone else (most problems are), but the few possible solutions I've found are dead ends. I miss my case sensitive search. :cry:
Back to top
View user's profile Send private message
RiBBiT
Apprentice
Apprentice


Joined: 18 May 2005
Posts: 215
Location: Sweden

PostPosted: Thu Apr 19, 2007 10:20 am    Post subject: Reply with quote

Perhaps you changed your locale settings? It's the LC_COLLATE environmental variable that should determine the ordering.

Code:
~ $ LC_COLLATE="sv_SE.utf8" ls -l
total 28
drwxr-xr-x 39 sork users 4096 Apr 18 19:48 alopex
drwxr-xr-x  2 sork users 4096 Apr 19 10:21 Desktop
lrwxrwxrwx  1 sork users   20 Oct 16  2006 laddar -> /mnt/lagrat1/laddar/
drwxr-xr-x  2 sork users 4096 Nov 15 08:12 lagrat
drwxr-xr-x 12 sork users 4096 Feb 20 19:19 Pontus
drwxr-xr-x 15 sork users 4096 Jan 25 16:38 Sara
drwxr-xr-x  2 sork users 4096 Oct 11  2006 Templates
drwxr-xr-x  3 sork users 4096 Mar 26 15:31 torrents
~ $ LC_COLLATE="POSIX" ls -l
total 28
drwxr-xr-x  2 sork users 4096 Apr 19 10:21 Desktop
drwxr-xr-x 12 sork users 4096 Feb 20 19:19 Pontus
drwxr-xr-x 15 sork users 4096 Jan 25 16:38 Sara
drwxr-xr-x  2 sork users 4096 Oct 11  2006 Templates
drwxr-xr-x 39 sork users 4096 Apr 18 19:48 alopex
lrwxrwxrwx  1 sork users   20 Oct 16  2006 laddar -> /mnt/lagrat1/laddar/
drwxr-xr-x  2 sork users 4096 Nov 15 08:12 lagrat
drwxr-xr-x  3 sork users 4096 Mar 26 15:31 torrents

_________________
Comix - GTK Comic Book Viewer [ http://comix.sourceforge.net ]
Back to top
View user's profile Send private message
jbo5112
n00b
n00b


Joined: 16 Nov 2005
Posts: 19

PostPosted: Thu Apr 26, 2007 2:25 am    Post subject: Reply with quote

Thanks! It didn't work, but it helped me figure out a quick and dirty fix. If I unset LANG and LC_ALL, then it gives me the traditional sorting I want. I'm sure at some point I'll figure out what they should be set to, but this works for now.
Back to top
View user's profile Send private message
BitJam
Advocate
Advocate


Joined: 12 Aug 2003
Posts: 2508
Location: Silver City, NM

PostPosted: Tue May 01, 2007 5:54 pm    Post subject: Reply with quote

Here is the proper way: Keep LC_ALL unset. Think of it as an emergency override. use LC_COLLATE=C to keep directory listings in ASCII order (uppercase before lowercase). Then set LANG to your language of choice. For example in my .zshrc (same for .bashrc) I have:
Code:
export LC_ALL=
export LANG=en_US
export LC_COLLATE=C
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Other Things Gentoo All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum