Search code examples
fileopen-sourcefile-extension

Why do open-source projects often have documentation files with no file extension?


Open-source projects generally come with a readme file, a file containing the text of the license, and maybe various other things. Often, one finds that these sundry documentation files are named without file extensions. Here is an example from Github. Often the names will be in capitals, as in "README" rather than "readme.txt".

This is a bit of a bother, because if you download a copy of the project, in order to open these files you have to add a file extension or each time, instruct the operating system on which program it should be opened in. Why would someone ever prefer not to add a file extension? Where does this irritating convention come from?


Solution

  • If you've used a Linux system much (or other traditional UNIX-like system such as the BSDs), you'll have likely noticed many types of files lack extensions, including executable files.

    Linux and other *nix systems tend to rely on methods other than the file's extension to determine a file's type (such as a magic code at the beginning, which many file formats have). You can test this out if you have a system with the 'file' utility (which is pre-installed on most operating systems other than Windows).

    The practice of naming the files README and such, without extension, dates pretty far back. When working on a console, you tend to open a file by doing something like program ./path/to/file, where 'program' is the name of the program you want to open with, and './path/to/file' is the path to the file you want to open (relative in this case, or absolute). Since you're instructing a specific program to open the file, no actual detection needs to be done to determine what program to open (although often modern text programs will try to detect non-text files and give a warning).

    Windows, on the other hand, associates the file extension with a specific program to open it; it doesn't look at the file content to determine which program to open. To open files without an extension in Windows, just right-click on the file, and you can pick whatever program you want to open it.

    In graphical environments for Linux (and other *nix OSes), the file extension isn't necessary, as they don't rely exclusively on extension to determine a file's type or which program to associate with it. Instead, associations are determined by MIME type, which in turn can be determined by the aforementioned "magic code."