New versions of Nautilus are cool, because they skip nonalphanumeric letters at the beginning of any file name and sort files according to the first alphanumeric letter (if any). But how to name a file in order to sort it before 0
? Assume I have a folder with these files:
0apple.conf
apricot.xml
banana
camel.so
cat.py
dog.tar.bz
and I want to add a one or two letter prefix to the cat.py
in order to sort it before 0apple.conf
file. I don't want to change the name, just add a prefix. I also don't want to change others' names. I've already tried:
#cat.py
and.cat.py
names and Greek alphabet prefixes sort file to the end (afterdog.tar.bz
file;.
changes also visibility)- any of
,-";:-–\_(?)*+%=<>!
prefixes sorts the file betweencamel.so
anddog.tar.bz
(like without any prefix).
Yes, there is an option to add more zeros to be near the beginning, but I want the file name as shortest as possible and at the very first position.
PS: My language is czech (therefore the collation should be something like cs
, cz
, czech
or cs_CZ
).
The prefix
0
already makes the file to be sorted at very first in Nautilus. What can come before the very first file? No files could, except directories. This is true regardless of locale in use.File naming
In the following example, I first created an empty text file named
apple.txt
then made multiple copies and rename each of the files by adding single character prefix. I have used only most compatible alphanumeric characters:0 A á _ -
and(space). This means I have created 7 files in total, plus a directory named
apple
for reference.Note that
á
is the second letter of Czech, which is found in this article section on Wikipedia. The first letter seems to be same as English:A
anda
.File sorting
How will Nautilus sort these files in different locale environment? Turns out that it is similar but slightly different. See the following screenshot for comparison.
Nautilus sorted files in English environment
en_US.UTF-8
like this:Nautilus sorted files in Czech environment
cs_CZ.UTF-8
like this:In both locales, there is no change in order of directory and top 3 files when viewing as list in Nautilus. This already shows that no alphanumeric character can appear before
0apple.txt
.Workaround 1
One way is to create files with name other than existing "apple" with same prefix
0
that precedes the existing one. Creating0aaa.txt
will come before0apple.txt
and so forth.Using this workaround, the files are sorted like this:
This way, the file
0.txt
would be the very first file to appear in Nautilus. No other files can come before0.txt
, unless user want to create a file name.txt
(using only a space character).Workaround 2
Say if
apple
is already the very first file that can exist and user insists to not renameapple
, there is another way: Rename the existing file with higher number prefix from0apple.txt
to9apple.txt
. This will allow other files with lower number prefix0*
to8*
to appear before9apple.txt
.Using this workaround, the files are sorted like this:
Workaround 2 is unsuitable, if the
0apple.txt
as whole cannot be renamed for whatever reason. Workaround 1 will be more effective since0.txt
will always appear before0mango.txt
or other file names that user can think of.How did I test
In my testing, only essential locale packages were installed to prepare Czech environment for running Nautilus in Ubuntu. The quick way to run program in other locale by
LANG=<LOCALENAME> nautilus
command didn't work. Hence, the following steps.Install these packages
language-pack-gnome-cs language-pack-gnome-cs-base language-pack-cs language-pack-cs-base
via APT in TerminalGo to System Settings > Language and Support
In Language - Language for menus and windows, drag the entry named
čeština
(word for "Czech" noted by Wikipedia) to aboveEnglish
Log out and log in again to take effect
Tested using Nautilus 3.14.3 in Ubuntu 16.04 LTS (Live).
TL;DR Filename with prefix
0
makes the very first file in Nautilus. No other files, except directories can appear before the very first file.Have you tried space zero as a prefix?
[ 0cat.py]
The other characters you mentioned does not work for me too but space zero works fine.
You can also try other combinations of spacial chars and zero, things like: -0cat.pay, _0cat.py, etc. these should work too.