Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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

1 Answer 1

up vote 3 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:

_00_READ_ME_FIRST
_01_NEXT_READ_ME

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

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.