I have many folders in my home directory that have names that begin with special characters such as _OLD_500GB_HD or !FolderIWantToSeeAtTheTop, but for some reason these folders are sorted according to their first alphanumeric character rather than the leading special character.

So how can I force the folder to not ignore the special character, or how else can I make the sort view organize certain folders at the top or bottom of the sort? Thanks.


1 Answer 1


Nautilus follows your locale's collation rules when sorting files by name. The rules for the English locales specify that punctuation, case and accents are less important than what letters occur in the string.

If you want collation to be equivalent to strcmp() sort order (i.e. do a simple comparison of the code point values for the characters in the string), you can switch to the legacy C locale for collation.

This can be done by editing ~/.profile and adding (or modifying) a line like the following:


When you next log in, the change should take effect in all programs that were using the locale collation order.

  • 2
    Perfect. Thanks, James. Would it be asking Nautilus too much to also maybe ignore case? In other words is there a way to get picky, i.e. ls --group-directories-first combined with sort --ignore case? Mar 25, 2012 at 1:14
  • 2
    As I said, Nautilus doesn't implement the sorting algorithm: it defers to the locale's collation algorithm. If there were a locale with an algorithm like that then it would use it. Creation of new locales is pretty heavy weight though, so it isn't trivial. Mar 25, 2012 at 2:57
  • Perfect! I had a similar problem with the program sort. It was unable to sort correctly a csv file with tabs. This solved the problem.
    – xerostomus
    Jan 13, 2017 at 6:22
  • For a temporary method that doesn't require logging out: killall nautilus && LC_COLLATE=C nautilus & Jun 16, 2020 at 17:03
  • @MarkJeronimus appreciate the faster testing approach. unfortunately LC_COLLATE=C or POSIX didn't change the sorting order of underscores. May 9, 2023 at 17:40

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .