Talk:Executable file
Jump to navigation
Jump to search
Does anyone know the executable file extension for GNU/Linux systems? I can't seem to find it anywhere. --David B (talk) 10:15, 13 May 2016 (EDT)
- There really isn't one. The idea that what a file is used for (roughly translated as "what applications can meaningfully read or manipulate the file") is a Microsoft notion. Unix, which long preceded DOS or Windows, has no connection between a file's name and its function. In fact, it originally had no notion of a file's "extension", that is, the part of the name after the (final) period. (That, by the way, is why Windows puts up a big warning notice when you are using the "rename" operation and change the extension.) On Windows, the extension is effectively part of the data of the file, whereas on Unix the entire meaning of a file is the bytes inside it.
- Unix has long had a hidden piece of data inside called the "magic number", that an application checks. That is, any file that is intended to be manipulated by a spreadsheet program has a magic number that effectively says "I am a spreadsheet file", and the spreadsheet application checks that number when it opens the file and refuses to operate if the number is wrong. There were magic numbers indicating that something is executable, and the loader checks those numbers before it starts running the program. The encoding is fairly complex, with flags indicating that the executable is position independent, relocatable, debuggable, linkable, etc. There was an allegedly standard file called "magic.h" that was the "code book" saying what the numbers meant. But I say "allegedly" because, in the pre-Linux days, Unix was pretty much a tower of Babel, with everyone making up their own rules, so compatibility was essentially impossible.
- So the idea of "launching" a file was a Microsoft idea. That is, you open the Explorer and double-click a file, and the system figures out what to do. If the extension is ".doc" that means run Word, if it is ".txt", run Wordpad. If it is ".exe", load it into instruction memory and run it. (This, by the way, is how computer viruses became such a big business. You send an email attachment that has a .exe extension, but cloak it to look like a picture. The situation is actually much more complicated than that, and the internet allows much more sophisticated malware now.)
- So, in classical Unix, you couldn't just click on a file in an explorer. You had to type both the application and the file name to the shell, as in "emacs foo" (edit the file "foo"), or "tar blah" (send the file "blah" to the archiver) or just "whatever" (execute "whatever" as a real executable. Modern Linux recognizes extensions, so a text file typically has an extension of ".txt", etc. And it has an explorer now, so you can double-click something and the system will take action depending on the extension. But there is no extension for an executable. You just double-click an executable (or type its name to the shell) and the system runs it, after carefully checking the header information inside. There is also some mechanism with the protection bits designed to prevent accidental running of files that aren't actual executables.
- That clears thinks up considerably! It not only voids my question, but explains my utter bafflement at Linux systems when I have tried to add programs to them in the past. I guess I was trying to figure out how to cook an egg with my deep fat fryer. (What would you get, anyway, poached in oil?) Anyway, I'll see if I can think of a way to smoothly shift over to briefly explaining that on this page, unless you want to since you clearly know a lot about it! Maybe I should also give Linux another try... --David B (talk) 12:56, 13 May 2016 (EDT)