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?

- 4,077
- 5
- 27
- 34
-
4identical/duplicate question: http://superuser.com/questions/282989/should-all-plain-text-files-have-some-sort-of-suffix-e-g-txt-conf/282993#282993 – 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
2 Answers
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.

- 2,495
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 directoryfoobar.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.

- 10,992