Nautilus natural filename sorting

Unfortunately Nautilus developers decided a long time ago (back in 2006) that sorting by name should mean "natural sorting". In their interpretation this means that filenames containing both numbers and letters are devided into "chunks" (i.e. characters sequences containing only letters or only numbers) and numbers are sorted numerically.

Eg. the filenames "3000abc63.txt" and "10000bla786.txt" will be sorted like this:
  1. 3000abcd.txt
  2. 10000blabla.txt
The reason is simple: both filenames start with numbers, so Nautilus splits each into chunks.
The "3000abcd.txt" filename will become:
  • 3000
  • abcd
  • 63
(maybe the extension is considered too, I'm not sure)
And "10000bla786.txt" will become this:
  • 10000
  • bla
  • 786
The "natural sorting" algorithm compares the two numbers first and since 3000 < 10000, "3000abcd.txt" will come before "10000bla786.txt" in the sorted file listing.

The real problem is that this is mandatory! You do not get to choose whether you want this sorting or not. There's only one way to sort by filenames in Nautilus and it's this one. What a pity. Sad Unfortunately this idea is spreading: Mint's Nemo is based off Nautilus, but inherited the same stupid name sorting. PCManFM works the same way.

There're quite many Nautilus users who hate this sorting method, but it seems that the fate of sorting files by name is final.

Comments

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

strange file soring by Nautilus

Thanks for enlighening on this "undocumented feature" aka "hidden design decision", which has been bothering me for a while, it is then however puzzling why the good-old command-line "ls -l" works the old-fashioned way (which for people like me is of course good news)

Re: strange file soring by Nautilus

I've got a few ideas on why the commandline ls won't adopt this natural sorting algorithm anytime soon:
  • The ls command is part of the coreutils package, meaning it's a lot more "core" than Nautilus.
  • Touching how ls behaves could/would have far reaching consequences ... scripts breaking, etc.
  • There'd be a rebellion of millions of linux users. Wink