LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 01-05-2005, 02:17 AM   #1
Simoncifer
LQ Newbie
 
Registered: Jan 2005
Distribution: Mandrake 10.0 Official Edition
Posts: 8

Rep: Reputation: 0
Filenames are sorted in wrong order


Hi. I just started using Mandrake 10.0 Official Edition recently, and I noticed that the filenames are sorted in a strange way: they seems to be sorted by only alphanumeric characters, and other characters are ignored.

Example, make 3 empty files "T-02", "T01", and "T03", by using
Code:
 more /dev/null > T01
When I look in Konqueror, the files are in the following order:
Code:
T01
T-02
T03
That doesn't seem right to me, seems like it is ignoring the "-" character.

This behavior is not just in Konqueror, but it is systemwide. I.E., when I get the same behavior of sorting when I use "ls" in Konsole, and even a file manager program that I downloaded: Krusader.

I even tried different partitions and filesystems. I tried on FAT32, Ext3, and ReiserFS, all give me the same result.

Is there some hidden setting in some configuration file to change this??

I have been reading help and man pages, and I tried to do a search in the forum using keyword "sorted", but nothing related to this ever comes up. So, it seems like I am the only one who has this problem.....

I am using Mandrake 10.0 Official Edition, kernel 2.6.3, KDE 3.2 BRANCH >= 20040204.

Thanks in advance to anyone who can solve this for me.
 
Old 01-05-2005, 02:40 AM   #2
slakmagik
Senior Member
 
Registered: Feb 2003
Distribution: Slackware
Posts: 4,113

Rep: Reputation: Disabled
LANG=en_US
LC_COLLATE=C

Never had an issue with it and don't know precisely how to fix it, but searching for those and like variables may point you in the direction of a solution, as that's what it sounds like - how the system is understanding how to sort things based on language/locale settings.

$ ls -1
T0-2
T01
T03

But I could be completely wrong.

Incidentally, to create an empty file
Code:
$ >empty_file
is easier.

-- Well, it is if you use bash - don't think it works in all shells. Even so 'touch empty_file' is another method.

Last edited by slakmagik; 01-05-2005 at 02:43 AM.
 
Old 01-06-2005, 02:09 AM   #3
Simoncifer
LQ Newbie
 
Registered: Jan 2005
Distribution: Mandrake 10.0 Official Edition
Posts: 8

Original Poster
Rep: Reputation: 0
I used KDE to set the country and language setting. But when I type "set" in Konsole, I get the following:
Code:
LANG=en_US.UTF-8
LANGUAGE=en_US.UTF-8:en_US:en
LC_ADDRESS=en_US.UTF-8
LC_COLLATE=en_US.UTF-8
So, I guessed I included unicode support. Do you think that's what causing the problem? If so, how can I turn off unicode support?

P.S. Thanks for the tips about the command to generate an empty file.

Quote:
Originally posted by digiot
LANG=en_US
LC_COLLATE=C
 
Old 01-06-2005, 02:55 AM   #4
slakmagik
Senior Member
 
Registered: Feb 2003
Distribution: Slackware
Posts: 4,113

Rep: Reputation: Disabled
Seems to be. I just did

export LANG=en_US.UTF-8 LANGUAGE=en_US.UTF-8:en_US:en LC_ADDRESS=en_US.UTF-8 LC_COLLATE=en_US.UTF-8

and screwed up my sorting just like yours. Exporting LC_COLLATE=C again fixed it.

If you export that in, um, Konsole, or whatever you use, and then try it, it should work, but you may need to log out entirely to get it to take effect everywhere. Plus, for all I know, KDE resets itself and I have no idea how to fix that.

- I went poking around and it turns out it's set in /etc/profile.d/lang.sh in Slack (and the comments also indicate that's the issue) but that wouldn't be how your system was set up, I don't think. You should still be able to put it in your personal bash configs, at least.
 
Old 01-07-2005, 12:52 AM   #5
Simoncifer
LQ Newbie
 
Registered: Jan 2005
Distribution: Mandrake 10.0 Official Edition
Posts: 8

Original Poster
Rep: Reputation: 0
It works

Thanks. I just added
Code:
 export LC_COLLATE=C
and the filenames are in correct order again.

I don't know where to put that in, and since I couldn't find the file you mentioned (the closest one is /etc/profile.d/10lang.sh, which has the comment at the top that said "# /etc/profile.d/lang.sh - set i18n stuff", and the file look complicated with all those "[ -n xxxx]" stuffs.... yeah, I probably need to learn that stuff soon). So, I added that line of "export" command in /etc/profile and it works. Actually, computer seems a little faster..... probably just my imagination

Thank you so much for your help.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Partitions in wrong order nukey Slackware 5 05-15-2005 05:50 AM
Grip writes filenames with wrong charset bruno buys Linux - Software 6 12-25-2004 04:01 AM
CUPS printing in wrong order boyceman Linux - Software 0 11-05-2004 10:12 AM
Wrong soundcards order Bothkill Slackware 11 07-22-2004 05:10 PM
ALSA Problem: 2 soundcards, wrong order PrivatePanic Linux - Hardware 4 09-04-2003 01:15 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 11:34 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration