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 Answer 1


Use the POSIX locale’s collation:


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


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

  • Thanks. That works. Maybe I should add export LC_ALL=C to my .bash_profile.
    – mount_dew
    Jul 2, 2020 at 11:13

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.