Stability of file name sort in Nautilus

On Ubuntu 18.04 with Gnome 3.28.2 sorting by file name in Nautilus produces this:

sort1
in bash:

paul@desktop:~/Documents/test$ ls -1
'0. output.pdf'
'$23 subt installation.txt'
'! bench2-extra.txt'
'$Docker Deep Dive.pdf'
'Docker in action.pdf'

On Ubuntu 20.04 with Gnome 3.36.2 the same files are sorted differently. In Nautilus:

sort2
in bash:

paul@extra-20:~/Documents$ ls -1
'$23 subt installation.txt'
'$Docker Deep Dive.pdf'
'0. output.pdf'
'! bench2-extra.txt'
'Docker in action.pdf'

Can someone make sense of this? Is there a stable method of prefixing file name to assure it being listed at the top?

1 Like

No. Well, yes: every program does whatever it wants because there’s no real reason to put whatever non-alphabetical and non-numerical character before (or after) another (well, when they are ASCII, we could at least try that, by tradition…). IIRC, the ls output is or was at one point “mostly random” (based on place on disc?), maybe it has changed: if you wanted then (and maybe now also) to have a logical output, it was asked to pipe into sort next. For the Nautilus evolution, well… “something has changed,” probably. Nobody wants nor is going to take the time to ensure a similar ordering of files in whatever future version will come.

No. Between applications not using the same toolkit (like a CLI tool and a GLib-based application), that’s probably a lost dream, if there’s not an normalized way to sort thing that you can bring in both projects and that they agree to respect. And between various versions of the same tool, that’s also quite unusual, as already stated.

If you have a good reason to put a file “on top,” then it should probably be discussed why exactly, and see if that use case could be generalized (and then, a function added for it, in some tools).

Edit: Nautilus has a “starred” function that I never used and looks broken on my computer (!) (the star is not a checkbutton, need to go in the menu to star file), maybe asking the default sort to put starred files on top would be an idea, if it doesn’t do it already?

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.