How does Plasma achieve natural sorting of files

For a while now I have been interested how Linux sorts files within file managers and file pickers within a desktop environment.
The more I have looked into / tested things out I realize more and more that their are many inconsistancies between how each desktop environment sorts files.

Plasma by far has the best sorting I have seen (based on my personal preference) because it seems to be identical to how file sorting occurs in Windows.
(Although I unfortunately found an issue that I have have put in a request for to see if will be fixed)

I was wondering if anyone knew how Plasma achieves its “natural” sort?
Is it built into the DE itself or is it based on “locale” setting such as LC_COLLATE=?

Getting back to the “consistancy” issues I mentioned above, all desktop enviroments seem to use the following locale collating setting (providing you set your DE language to US English)


When Plasma uses this setting it generates “natural” sort and yet when other DE have this setting it generates the standard Linux based sorting method (don’t know the name of it).

In the past I believe I compared the files of each and they were the same, so that is why I would imagine Plasma has this setting built into its actual coding and not this file? Does anyone know if this is true?

Even stranger their is another sorting method known as “C” that is available in Plasma as well as all other DE.


I believed this was a standard sorting that would be the same in every DE but that is not the case. A couple DE sort differently when using this “C” setting, Plasma is one of them. Does not matter to me because as mentioned I like the natural sorting Plasma provides but just odd.

With research I have seen mentioned that all file sorting is based on a file called “iso14651_t1_common” located in the folder “usr/share/i18n/locales” Does anyone know if Plasma uses this to achieve its natural sort?

I have asked around and it does not seem that many have any knowledge about file sorting in Linux, at least I have not found too many people that do anyways.
Some Linux users seem to have tons of knowledge about some crazy stuff but yet when it comes to something as simple as file sorting it is like a big mystery.

If anyone can share some information about this I would appreciate it, just curious.
Thank You

1 Like