Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

What I want to do is make it so a particular file is listed at the top when using ls or browsing via file manager like Nautilus. I want this to work without any system configuration as the files will be on a number of machines. If this was Windows I would just prefix the file name with an underscore e.g _myfile.txt, however this does not seem to work using Linux.

The reason I want to do this is because I want a couple of README files to listed before the others so they will have better viability. I Googled around but couldn't find a definitive answer, does anyone know how I could this, or even if it is possible? Any advice is appreciated. Thanks!

share|improve this question
add "aaaaaaaaaaaaaaaaa" prefix to a file :) – week Nov 15 '12 at 17:56
I've tended to use underscores for items that need to be listed first. This works in Windows Explorer (which, in newer versions of Windows, is nonetheless smart enough to sort 9 before 10). However, the file managers for most major Linux desktop environments, including Dolphin, Nautilus, and Thunar (the Xfce file manager), ignore underscores, so this really won't work in a Linux environment. – bwDraco Oct 16 '15 at 5:53
up vote 4 down vote accepted

Nautilus tries to be clever in sorting filenames, (mostly) ignoring non-alphanumeric characters and sorting numbers "naturally" so that e.g. 9z.txt appears before 10a.txt. The result of this "cleverness" is sometimes rather odd.

Because filenames beginning with numbers appear before filenames beginning with letters (and the rather odd way Nautilus sorts filenames that begin with a mixture of digits and non-alphanumeric characters), a filename like _0_README will appear before any others. You could extend that with a scheme like:


... which should also sort as you intend in the Windows file manager.

share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .