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.

A prominent and common example of this is the hosts file in C:\windows\system32\drivers\etc. I'm curious what the purpose of having files without extensions is.

share|improve this question

migrated from stackoverflow.com Oct 12 '11 at 21:10

This question came from our site for professional and enthusiast programmers.

closed as not constructive by Tom Wijsman, Ƭᴇcʜιᴇ007, Kyle, random Oct 18 '11 at 3:53

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.If this question can be reworded to fit the rules in the help center, please edit the question.

    
What is the purpose of having a file with an extension? –  Blender Oct 12 '11 at 16:17
1  
@Blender - typically to associate it with a program to open it. –  Barry Oct 12 '11 at 16:19
    
What about mime types? Tons of files in Linux don't have extensions, yet can be opened with their respective programs. –  Blender Oct 12 '11 at 16:19
    
The files of the etc folder are some sort of (undefined?) inter-OS standard. They share the same names and syntax on linux. Also, what has this to do with software development? –  Dennis Oct 12 '11 at 16:21
    
I think in this case it's because they got the idea (a long, long time ago) from how Unix systems structured their layouts (the etc folder for example), and hosts is named the same way (without .txt) in Unix systems. In fact Windows has some influence from the BSD lineage, I think Windows' ftp.exe, if I remember, is pretty much the same as BSD's ftp program. –  birryree Oct 12 '11 at 16:21

2 Answers 2

up vote 1 down vote accepted

While filename suffixed extensions under windows are fairly ubiquitous, they are not necessary, they are more of a convenience to give the OS a cue as to which application should open the file if double clicked.

You could choose to forego extensions entirely - for example renaming mydocument.doc to mydocument. All that would happen is that you would need to either say which application should open the file when prompted if you double-clicked it, or open Word first and use it to open the file.

An .exe file also doesn't need an extension, though it may be harder to get them to execute - one way would be from a command prompt: start <executable> for example.

The hosts file doesn't have an extension because the tcp/ip implementation on Windows followed the unix implementation, with a bit of cludging, and now it is stuck that way for legacy reasons.

share|improve this answer

IMHO hosts is without extension for historical reasons, I guess it's some kind of old lanman legacy. (which probably is also some kind of legacy with Unix like hosts file)

share|improve this answer
    
-1 for guessing, and guessing wrong. –  JdeBP Oct 13 '11 at 7:33

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