Sort order when using ll
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=
16.04 command-line files directory ext4
add a comment |
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=
16.04 command-line files directory ext4
See also thelsinfo page
– glenn jackman
9 hours ago
add a comment |
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=
16.04 command-line files directory ext4
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=
16.04 command-line files directory ext4
16.04 command-line files directory ext4
edited 9 hours ago
Socrates
asked 9 hours ago
SocratesSocrates
7971230
7971230
See also thelsinfo page
– glenn jackman
9 hours ago
add a comment |
See also thelsinfo page
– glenn jackman
9 hours ago
See also the
ls info page– glenn jackman
9 hours ago
See also the
ls info page– glenn jackman
9 hours ago
add a comment |
1 Answer
1
active
oldest
votes
ls' sort order is defined by your locale's collation setting. You can easily check this with the locale command:
$ locale
LANG=en_US.UTF-8
LANGUAGE=en_US
LC_CTYPE="en_US.UTF-8"
LC_NUMERIC=de_DE.UTF-8
LC_TIME=de_DE.UTF-8
LC_COLLATE="en_US.UTF-8"
LC_MONETARY=de_DE.UTF-8
LC_MESSAGES="en_US.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=
Important for sorting is the LC_COLLATE value. In my example above, it would sort according to the rules for en_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.
LC_COLLATE=C ll
I tried that, but actuallylsdoesn’t acknowledgeLC_COLLATEbut onlyLC_ALL– oh wait, but with an emptyLC_ALLit does work:LC_ALL= LC_COLLATE=C ll
– dessert
9 hours ago
1
@dessertLC_COLLATEis responsible for sorting.LC_ALLoverrides all otherLC_*values though if it is set, so if changingLC_COLLATEhas no effect, I assume you haveLC_ALLset to something else at the same time? When you just check the output oflocale,LC_ALLshould be empty.
– Byte Commander
9 hours ago
1
Alright, thanks both of you! I found out that I had the German locale "kind of" installed, so I installed it again withsudo locale-gen de_DE.UTF-8followed bysudo update-localeand it now works perfectly.
– Socrates
8 hours ago
add a comment |
Your Answer
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "89"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f1119866%2fsort-order-when-using-ll%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
ls' sort order is defined by your locale's collation setting. You can easily check this with the locale command:
$ locale
LANG=en_US.UTF-8
LANGUAGE=en_US
LC_CTYPE="en_US.UTF-8"
LC_NUMERIC=de_DE.UTF-8
LC_TIME=de_DE.UTF-8
LC_COLLATE="en_US.UTF-8"
LC_MONETARY=de_DE.UTF-8
LC_MESSAGES="en_US.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=
Important for sorting is the LC_COLLATE value. In my example above, it would sort according to the rules for en_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.
LC_COLLATE=C ll
I tried that, but actuallylsdoesn’t acknowledgeLC_COLLATEbut onlyLC_ALL– oh wait, but with an emptyLC_ALLit does work:LC_ALL= LC_COLLATE=C ll
– dessert
9 hours ago
1
@dessertLC_COLLATEis responsible for sorting.LC_ALLoverrides all otherLC_*values though if it is set, so if changingLC_COLLATEhas no effect, I assume you haveLC_ALLset to something else at the same time? When you just check the output oflocale,LC_ALLshould be empty.
– Byte Commander
9 hours ago
1
Alright, thanks both of you! I found out that I had the German locale "kind of" installed, so I installed it again withsudo locale-gen de_DE.UTF-8followed bysudo update-localeand it now works perfectly.
– Socrates
8 hours ago
add a comment |
ls' sort order is defined by your locale's collation setting. You can easily check this with the locale command:
$ locale
LANG=en_US.UTF-8
LANGUAGE=en_US
LC_CTYPE="en_US.UTF-8"
LC_NUMERIC=de_DE.UTF-8
LC_TIME=de_DE.UTF-8
LC_COLLATE="en_US.UTF-8"
LC_MONETARY=de_DE.UTF-8
LC_MESSAGES="en_US.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=
Important for sorting is the LC_COLLATE value. In my example above, it would sort according to the rules for en_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.
LC_COLLATE=C ll
I tried that, but actuallylsdoesn’t acknowledgeLC_COLLATEbut onlyLC_ALL– oh wait, but with an emptyLC_ALLit does work:LC_ALL= LC_COLLATE=C ll
– dessert
9 hours ago
1
@dessertLC_COLLATEis responsible for sorting.LC_ALLoverrides all otherLC_*values though if it is set, so if changingLC_COLLATEhas no effect, I assume you haveLC_ALLset to something else at the same time? When you just check the output oflocale,LC_ALLshould be empty.
– Byte Commander
9 hours ago
1
Alright, thanks both of you! I found out that I had the German locale "kind of" installed, so I installed it again withsudo locale-gen de_DE.UTF-8followed bysudo update-localeand it now works perfectly.
– Socrates
8 hours ago
add a comment |
ls' sort order is defined by your locale's collation setting. You can easily check this with the locale command:
$ locale
LANG=en_US.UTF-8
LANGUAGE=en_US
LC_CTYPE="en_US.UTF-8"
LC_NUMERIC=de_DE.UTF-8
LC_TIME=de_DE.UTF-8
LC_COLLATE="en_US.UTF-8"
LC_MONETARY=de_DE.UTF-8
LC_MESSAGES="en_US.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=
Important for sorting is the LC_COLLATE value. In my example above, it would sort according to the rules for en_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.
LC_COLLATE=C ll
ls' sort order is defined by your locale's collation setting. You can easily check this with the locale command:
$ locale
LANG=en_US.UTF-8
LANGUAGE=en_US
LC_CTYPE="en_US.UTF-8"
LC_NUMERIC=de_DE.UTF-8
LC_TIME=de_DE.UTF-8
LC_COLLATE="en_US.UTF-8"
LC_MONETARY=de_DE.UTF-8
LC_MESSAGES="en_US.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=
Important for sorting is the LC_COLLATE value. In my example above, it would sort according to the rules for en_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.
LC_COLLATE=C ll
answered 9 hours ago
Byte CommanderByte Commander
64.8k27178298
64.8k27178298
I tried that, but actuallylsdoesn’t acknowledgeLC_COLLATEbut onlyLC_ALL– oh wait, but with an emptyLC_ALLit does work:LC_ALL= LC_COLLATE=C ll
– dessert
9 hours ago
1
@dessertLC_COLLATEis responsible for sorting.LC_ALLoverrides all otherLC_*values though if it is set, so if changingLC_COLLATEhas no effect, I assume you haveLC_ALLset to something else at the same time? When you just check the output oflocale,LC_ALLshould be empty.
– Byte Commander
9 hours ago
1
Alright, thanks both of you! I found out that I had the German locale "kind of" installed, so I installed it again withsudo locale-gen de_DE.UTF-8followed bysudo update-localeand it now works perfectly.
– Socrates
8 hours ago
add a comment |
I tried that, but actuallylsdoesn’t acknowledgeLC_COLLATEbut onlyLC_ALL– oh wait, but with an emptyLC_ALLit does work:LC_ALL= LC_COLLATE=C ll
– dessert
9 hours ago
1
@dessertLC_COLLATEis responsible for sorting.LC_ALLoverrides all otherLC_*values though if it is set, so if changingLC_COLLATEhas no effect, I assume you haveLC_ALLset to something else at the same time? When you just check the output oflocale,LC_ALLshould be empty.
– Byte Commander
9 hours ago
1
Alright, thanks both of you! I found out that I had the German locale "kind of" installed, so I installed it again withsudo locale-gen de_DE.UTF-8followed bysudo update-localeand it now works perfectly.
– Socrates
8 hours ago
I tried that, but actually
ls doesn’t acknowledge LC_COLLATE but only LC_ALL – oh wait, but with an empty LC_ALL it does work: LC_ALL= LC_COLLATE=C ll– dessert
9 hours ago
I tried that, but actually
ls doesn’t acknowledge LC_COLLATE but only LC_ALL – oh wait, but with an empty LC_ALL it does work: LC_ALL= LC_COLLATE=C ll– dessert
9 hours ago
1
1
@dessert
LC_COLLATE is responsible for sorting. LC_ALL overrides all other LC_* values though if it is set, so if changing LC_COLLATE has no effect, I assume you have LC_ALL set to something else at the same time? When you just check the output of locale, LC_ALL should be empty.– Byte Commander
9 hours ago
@dessert
LC_COLLATE is responsible for sorting. LC_ALL overrides all other LC_* values though if it is set, so if changing LC_COLLATE has no effect, I assume you have LC_ALL set to something else at the same time? When you just check the output of locale, LC_ALL should be empty.– Byte Commander
9 hours ago
1
1
Alright, thanks both of you! I found out that I had the German locale "kind of" installed, so I installed it again with
sudo locale-gen de_DE.UTF-8 followed by sudo update-locale and it now works perfectly.– Socrates
8 hours ago
Alright, thanks both of you! I found out that I had the German locale "kind of" installed, so I installed it again with
sudo locale-gen de_DE.UTF-8 followed by sudo update-locale and it now works perfectly.– Socrates
8 hours ago
add a comment |
Thanks for contributing an answer to Ask Ubuntu!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f1119866%2fsort-order-when-using-ll%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
See also the
lsinfo page– glenn jackman
9 hours ago