Forums

Skip to content

Advanced search
  • Quick links
    • Unanswered topics
    • Active topics
    • Search
  • FAQ
  • Login
  • Register
  • Board index Assistance Other Things Gentoo
  • Search

Sorting order for ls changed

Still need help with Gentoo, and your question doesn't fit in the above forums? Here is your last bastion of hope.
Post Reply
Advanced search
4 posts • Page 1 of 1
Author
Message
jbo5112
n00b
n00b
Posts: 19
Joined: Wed Nov 16, 2005 2:01 am

Sorting order for ls changed

  • Quote

Post by jbo5112 » Thu Apr 19, 2007 3:37 am

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:
Top
RiBBiT
Apprentice
Apprentice
User avatar
Posts: 215
Joined: Wed May 18, 2005 7:16 am
Location: Sweden

  • Quote

Post by RiBBiT » Thu Apr 19, 2007 10:20 am

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

Code: Select all

~ $ 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 ]
Top
jbo5112
n00b
n00b
Posts: 19
Joined: Wed Nov 16, 2005 2:01 am

  • Quote

Post by jbo5112 » Thu Apr 26, 2007 2:25 am

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.
Top
BitJam
Advocate
Advocate
Posts: 2513
Joined: Tue Aug 12, 2003 4:15 pm
Location: Silver City, NM

  • Quote

Post by BitJam » Tue May 01, 2007 5:54 pm

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: Select all

export LC_ALL=
export LANG=en_US 
export LC_COLLATE=C
Top
Post Reply

4 posts • Page 1 of 1

Return to “Other Things Gentoo”

Jump to
  • Assistance
  • ↳   News & Announcements
  • ↳   Frequently Asked Questions
  • ↳   Installing Gentoo
  • ↳   Multimedia
  • ↳   Desktop Environments
  • ↳   Networking & Security
  • ↳   Kernel & Hardware
  • ↳   Portage & Programming
  • ↳   Gamers & Players
  • ↳   Other Things Gentoo
  • ↳   Unsupported Software
  • Discussion & Documentation
  • ↳   Documentation, Tips & Tricks
  • ↳   Gentoo Chat
  • ↳   Gentoo Forums Feedback
  • ↳   Duplicate Threads
  • International Gentoo Users
  • ↳   中文 (Chinese)
  • ↳   Dutch
  • ↳   Finnish
  • ↳   French
  • ↳   Deutsches Forum (German)
  • ↳   Diskussionsforum
  • ↳   Deutsche Dokumentation
  • ↳   Greek
  • ↳   Forum italiano (Italian)
  • ↳   Forum di discussione italiano
  • ↳   Risorse italiane (documentazione e tools)
  • ↳   Polskie forum (Polish)
  • ↳   Instalacja i sprzęt
  • ↳   Polish OTW
  • ↳   Portuguese
  • ↳   Documentação, Ferramentas e Dicas
  • ↳   Russian
  • ↳   Scandinavian
  • ↳   Spanish
  • ↳   Other Languages
  • Architectures & Platforms
  • ↳   Gentoo on ARM
  • ↳   Gentoo on PPC
  • ↳   Gentoo on Sparc
  • ↳   Gentoo on Alternative Architectures
  • ↳   Gentoo on AMD64
  • ↳   Gentoo for Mac OS X (Portage for Mac OS X)
  • Board index
  • All times are UTC
  • Delete cookies

© 2001–2026 Gentoo Foundation, Inc.

Powered by phpBB® Forum Software © phpBB Limited

Privacy Policy

 

 

magic