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.

I create many notes in plain text files, but after a while the .txt suffix I put at the end of them seems to be unnecessary typing and visual noise. Is appending .txt to plain text files a strongly encouraged convention or just a suggestion?

share|improve this question
add comment

4 Answers

up vote 9 down vote accepted

The .txt filename extension serves a purpose on Windows, where the filename extension helps determine which programs are associated with that file - which one is used to open, edit or perform other types of action on it.

On Unix/GNU-Linux, the system works out the type of a file without referring to the filename extension. It does have some uses in Makefiles. [update:] As grawity noted in a comment below, the filename extension is used by Linux file-managers (I assume this means GUI apps like nautilus and character apps like mc).

However I find it a useful convention to adhere to anyway.

share|improve this answer
    
Most file managers for Linux do use the file extensions, as it's the only method with reasonable performance. –  grawity May 13 '11 at 13:45
    
@grawity: Ah right - I don't use file manglers on Linux (GUI, CUI, TUI or otherwise) –  RedGrittyBrick May 13 '11 at 13:49
    
In windows, you can hide known file extensions. If you are using notepad for notes, it will automatically append the .txt extension to the end. –  Doltknuckle May 13 '11 at 15:21
    
It's especially useful to adhere to an editor's default file extensions for Open/Save dialogs, if possible. Some Windows Open File dialogs will filter out all non-conforming files and you need to explicitly select All file types or something like that first. Inconvenient. –  Daniel Beck May 13 '11 at 16:31
    
In the strictest sense, OS X allows you to avoid using file extensions if you want to, but using them enables you to influence the way the OS treats the file. Most of the time, OS X can attempt to guess what the filetype is, but the convention doesn't hurt. You can hide the extensions anyway if you want. :) –  Lukasa May 13 '11 at 16:59
add comment

Nothing more then convention, IMO.

I almost never use file extensions (in Windows) for text files. In general, I always know what is in my files, & generally always open files from within a file manager, either to view (happens to be F3) or to edit (happens to be F4) or from a context menu (to open in Vim).

The only odd time that I add an extension, is if I know the for a particular file I'll specifically want to open in something that I normally do not use (like Notepad) in which case I'll append an extension (like .doc) to the filename so that it will open in the default application (Notepad, for me).

If you want to perform an action on a set of files (as mentioned above) & if having an extension such as .txt helps, then I would do something like that for that set. (I do something similar, though instead of an extension, I have numerically numbered sets of files, so I can select 7* to get all the files that start with the number 7, to process them further.)

share|improve this answer
add comment

Under Unix, it is useful to perform operations that are restricted to just textfiles. For instance

ls *.txt

will show you just the text files, while

find . -name \*.txt -exec grep foo -H {} +

will search for foo in all of the text files under the current directory. Even if you don't do this often, it is useful occasionally.

share|improve this answer
add comment

Assuming you are on Windows - if you don't put a file extension on, then it won't automatically open when you double click it. It is certainly "strongly encouraged."

share|improve this answer
add comment

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.