I recently switched from Windows to Ubuntu and miss being able to put characters such as ~, _, or ! at the beginning of a filename to keep files and folders near the top when sorted alphabetically. In Ubuntu, those names may appear at the bottom or somewhere in the middle instead. How can I configure the file manager to sort these names more like Windows does?
2 Answers
The sorting behavior depends on the application and your locale settings. In a terminal, commands such as `ls` use the `LC_COLLATE` locale variable, so setting it to a C-style locale can produce ASCII ordering. For example: `LC_COLLATE=C.UTF-8 ls`. That makes punctuation sort according to its character values, although it only affects that command.
Ubuntu's file explorer may follow the desktop environment's locale and its own sorting rules rather than using the exact Windows ordering. `LC_COLLATE=C.UTF-8 nautilus` launches Nautilus with ASCII-style collation for that session; it doesn't permanently configure the file manager. You may need to set the locale when launching it or adjust the file manager's sorting preferences, but symbol ordering is not guaranteed to match Windows exactly.

I mainly want this behavior in Ubuntu's graphical file explorer. Ubuntu normally uses GNOME with the Nautilus file manager, and I wasn't sure what the locale command was supposed to change.