0

In CentOS 6.9 final, ls -Al lists files by ASCII code order, and files starting with a dot(the hidden files) will be displayed on the top of the output. But when I upgraded to CentOS 7.5, ls -Al doesn't put the hidden files on the top. It seems like the starting dot of the hidden files will be removed when sorting by ASCII order. Just like the below picture shows. I personally prefer the old way(sorting by ASCII code strictly). How can I make that happen? Thanks! enter image description here

1 Answers1

3

Use the POSIX locale’s collation:

LC_COLLATE=C ls -Al

or better yet, its non-POSIX UTF-8 variant:

LC_COLLATE=C.UTF-8 ls -Al

See also How can I make “ls” show dotfiles first while staying case-insensitive?

Stephen Kitt
  • 434,908