View previous topic :: View next topic |
Author |
Message |
jbo5112 n00b
Joined: 16 Nov 2005 Posts: 19
|
Posted: Thu Apr 19, 2007 3:37 am Post subject: Sorting order for ls changed |
|
|
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. |
|
Back to top |
|
|
RiBBiT Apprentice
Joined: 18 May 2005 Posts: 215 Location: Sweden
|
Posted: Thu Apr 19, 2007 10:20 am Post subject: |
|
|
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 |
|
|
jbo5112 n00b
Joined: 16 Nov 2005 Posts: 19
|
Posted: Thu Apr 26, 2007 2:25 am Post subject: |
|
|
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 |
|
|
BitJam Advocate
Joined: 12 Aug 2003 Posts: 2508 Location: Silver City, NM
|
Posted: Tue May 01, 2007 5:54 pm Post subject: |
|
|
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 |
|
|
|