1

I'd like ls to sort

  1. By filename (case insensitive)
  2. By "version" (-v)

I often have directories in which there are some numbered files like

1-FileA
2-FileB
...
9-FileC
10-FileD
...
19-FileE
20-FileF

and so forth. Now, with the -v option I'm able to make ls sort by the number prepended to the file name (so I see 1-FileA, ..., 9-FileC, 10-FileD instead of 1-FileA, 10-FileD, ..., 19-FileE, 2-FileB) and the option --group-directories-first allows me to list directories first, but the sort is not case insensitive, instead, it shows directories that begin with a (sequence of) uppercase letter(s) and then directories that have only lowercase letters and then files with the same criterion.

I'd like to order them regardless the "casing" of the file/directory name. Is there a way to achieve this without using the sort command (which would get rid of the coloring produced by the ls option --color=auto)?

EDIT: I'm using Debian GNU/Linux and the output of locale is

LANG=en_US.UTF-8
LANGUAGE=en_US:en
LC_CTYPE="en_US.UTF-8"
LC_NUMERIC=it_IT.UTF8
LC_TIME=it_IT.UTF8
LC_COLLATE="en_US.UTF-8"
LC_MONETARY=it_IT.UTF8
LC_MESSAGES="en_US.UTF-8"
LC_PAPER=it_IT.UTF8
LC_NAME="en_US.UTF-8"
LC_ADDRESS="en_US.UTF-8"
LC_TELEPHONE="en_US.UTF-8"
LC_MEASUREMENT=it_IT.UTF8
LC_IDENTIFICATION="en_US.UTF-8"
LC_ALL=

Thanks in advance.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.