Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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.

share|improve this question
up vote 3 down vote accepted

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.

share|improve this answer
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? – Jason Hartley Mar 25 '12 at 1:14
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. – James Henstridge Mar 25 '12 at 2:57

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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