How can I make files starting with symbols sort first in Ubuntu?
Asked by
MellowCedar42
I recently switched from Windows to Ubuntu after using Windows for many years. I used to put characters such as ~, _, or ! at the beginning of a file or folder name to make it appear near the top when items were sorted alphabetically. In Ubuntu, those names may appear at the bottom or somewhere in the middle instead. How can I configure the file manager so special characters sort more like they did in Windows?
Answers
The result depends on which program is doing the sorting. In a terminal, `ls` follows your system's locale settings, especially `LC_COLLATE`. For example, running `LC_COLLATE=C.UTF-8 ls` uses a more direct ASCII-style order, which can place punctuation differently. Graphical file managers usually follow the desktop environment's sorting and locale settings; on Ubuntu's default GNOME desktop, that generally means Files (Nautilus). Launching it with `LC_COLLATE=C.UTF-8` can test whether that ordering is what you want, although it may not permanently change the file manager's behavior.
Reply to this answer
Add your answer
Answers are reviewed before publication.
MellowCedar42: I mainly want this to work in the graphical file explorer. Ubuntu uses GNOME and Files, but I wasn't sure what the desktop environment meant. Running the command only opened the file manager, so I wasn't sure what effect it was supposed to have.