Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. 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

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

closed as off topic by Michael Mrozek May 13 '11 at 14:35

Questions on Unix & Linux Stack Exchange are expected to relate to Unix or Linux within the scope defined by the community. Consider editing the question or leaving comments for improvement if you believe the question can be reworded to fit within the scope. Read more about reopening questions here.If this question can be reworded to fit the rules in the help center, please edit the question.

identical/duplicate question: superuser.com/questions/282989/… – RedGrittyBrick May 13 '11 at 14:00
The SU version was posted first and this looks like a generic question (i.e. not asking about *nix specifically), so I'm going to close it here. @dan If you'd prefer it be here, flag the SU version and ask them to migrate it and we'll merge here – Michael Mrozek May 13 '11 at 14:34

Adding any extension to any file on Linux/Unix systems is totally optional.

However it is much easier to recognise which file contains what type of information at a glance with suitable extensions, particularly when you share your files with others.

Also for integration with GUI desktops (or automation of tasks, such as compiling programs), it makes file association much easier - although some associations can be infered from identification within the file, such as the #! for executable scripts and magick number for a variety of file formats, this is not the case for other types of contents, such as plain text or some of the raw images for instance.

So at the end of the day it depends on what your text files mean to you and what you do with them.

share|improve this answer

I would add .txt if:

  • you ever expect it to be opened on a Windows system
  • you might have other files with the same name (for example, if you have an executable named foobar and then a text file in the same directory foobar.txt)
  • it's not obvious from the name that it's a text file, or you think you'd later forget
  • you ever expect to later try to include it in a search of all .txt files in a massive file hierarchy

There's lots of "types" of files in Linux/UNIX that are text files, for example, documentation files, configuration files, scripts, source code. By adding .txt you are disambiguating that this is a text file meant to be read and understood only by a human for various purposes. So I would tend to add it.

And to actually answer your question, it is indeed a convention which probably came into vogue after the rise of DOS.

share|improve this answer

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