I was using ls -l on a directory, and was surprised that spaces and underscores were ignored for the sort order. For example,
$ echo $LANG
en_AU.UTF-8
$ ls -l
total 0
-rw-r--r-- 1 sparhawk sparhawk 0 Nov 20 21:12 a_a
-rw-r--r-- 1 sparhawk sparhawk 0 Nov 20 21:13 a b
-rw-r--r-- 1 sparhawk sparhawk 0 Nov 20 21:13 a_c
-rw-r--r-- 1 sparhawk sparhawk 0 Nov 20 21:13 a d
$ LANG=en_AU ls -l
total 0
-rw-r--r-- 1 sparhawk sparhawk 0 Nov 20 21:13 a b
-rw-r--r-- 1 sparhawk sparhawk 0 Nov 20 21:13 a d
-rw-r--r-- 1 sparhawk sparhawk 0 Nov 20 21:12 a_a
-rw-r--r-- 1 sparhawk sparhawk 0 Nov 20 21:13 a_c
In my default locale, spaces and underscores are interchangeable, and without UTF-8, spaces come before underscores. I see similar results for en_US and en_US.UTF-8.
I have two questions:
- Am I interpreting this correctly? Are they interchangeable?
- Is there a list of my locale's sort order? I want to find a character that precedes underscore.