Is there a way to set the sort order of the files and directories when using the ll
command? I have two 16.04.5 servers with two ext4
drives. One folder exists on both drives containing the same files. When using ll
on both servers the sort order is not the same (ls -l
has the same result):
ll
on server a:
Alex.txt
iBoy.txt
Immatriculation.txt
Radius.txt
WonderWoman.txt
ll
on server b:
Alex.txt
Immatriculation.txt
Radius.txt
WonderWoman.txt
iBoy.txt
So the difference is the file iBoy.txt
. Is there a way to figure out why this file is not located between Alex.txt
and Immatriculation.txt
like on server a?
EDIT 1:
As requested, here are the locales of both systems.
locale
on server a:
LANG=de_DE.UTF-8
LANGUAGE=
LC_CTYPE="de_DE.UTF-8"
LC_NUMERIC=de_DE.UTF-8
LC_TIME="de_DE.UTF-8"
LC_COLLATE="de_DE.UTF-8"
LC_MONETARY=de_DE.UTF-8
LC_MESSAGES="de_DE.UTF-8"
LC_PAPER=de_DE.UTF-8
LC_NAME=de_DE.UTF-8
LC_ADDRESS=de_DE.UTF-8
LC_TELEPHONE=de_DE.UTF-8
LC_MEASUREMENT=de_DE.UTF-8
LC_IDENTIFICATION=de_DE.UTF-8
LC_ALL=
locale
on server b:
locale: Cannot set LC_CTYPE to default locale: No such file or directory
locale: Cannot set LC_MESSAGES to default locale: No such file or directory
locale: Cannot set LC_ALL to default locale: No such file or directory
LANG=de_DE.UTF-8
LANGUAGE=
LC_CTYPE="de_DE.UTF-8"
LC_NUMERIC=de_DE.UTF-8
LC_TIME="de_DE.UTF-8"
LC_COLLATE="de_DE.UTF-8"
LC_MONETARY=de_DE.UTF-8
LC_MESSAGES="de_DE.UTF-8"
LC_PAPER=de_DE.UTF-8
LC_NAME=de_DE.UTF-8
LC_ADDRESS=de_DE.UTF-8
LC_TELEPHONE=de_DE.UTF-8
LC_MEASUREMENT=de_DE.UTF-8
LC_IDENTIFICATION=de_DE.UTF-8
LC_ALL=
ls
' sort order is defined by your locale's collation setting. You can easily check this with thelocale
command:Important for sorting is the
LC_COLLATE
value. In my example above, it would sort according to the rules foren_US.UTF.8
localization, which would sort file names case-insensitive and seems to ignore punctuation characters.You can temporarily override your global settings with an environment variable. E.g. the
C
locale/collation would sort by the raw ASCII value, so all uppercase letters are before lowercase.