Changing the default sort sequence

Newer Linux distributions changed the default behaviour for sorting alphanumeric values. The characters are not sorted by their ASCII value anymore, so upper and lower case characters and also dot files are displayed in alphabetical order:

user@host: ls -a
alpha
Beta
.gamma

To switch back to the old sort sequence you'll have to change the value of the variable LC_COLLATE from de_DE or en_US to POSIX. This can be done with the following command: export LC_COLLATE=POSIX. Now the system uses the old sort sequence:

user@host: ls -a
.gamma
Beta
alpha

Notice that this change only affects the actual command line session and its children. To change this value permanently you'll have to add the command line in your personal shell configuration file, e.g. ~/.bashrc for bash users.

-- StefanHaller - 17 Apr 2008
Topic revision: r1 - 2008-04-17, StefanHaller - This page was cached on 2024-12-20 - 18:59.

<!-- With LdapContrib WikiUsers becomes irrelevant -->
%IF{"'%WIKINAME%'!='WikiGuest'" then="$n   * [[$percentUSERSWEB$percent.$percentWIKIUSERSTOPIC$percent][ $percentICON{\"person\"}$percent $percentMAKETEXT{\"Users\"}$percent]]"}% \

This site is powered by FoswikiCopyright © by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding GSI Wiki? Send feedback | Legal notice | Privacy Policy (german)