How does ls -l sorts files?

Viewed 56

I have question about sorting files by ls -l. I read in manual that it divides directories and non-directories and sorts them in lexicographic order separately, but run into situation where ls doesn't follow this rule, here is example: enter image description here

First files, then directories and then files again

Why it displays like this?

1 Answers

The sorting order depends on hosts' locale.

In my Linux host the sorting order is by UTF-8, upper case Letters are before lower case letters.

In addition

Suggesting to try:

\ls -l

And check the results.

Explanation:

In most interactive shells. ls is an alias that adds coloring and sorting.

Typing \ls overides the alias

It is possible to inspect the specific alias with

alias ls
Related