LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   .exe file (https://www.linuxquestions.org/questions/linux-newbie-8/exe-file-4175527623/)

jkl123 12-07-2014 05:00 PM

.exe file
 
Why doesn't Linux have .exe files? It would seem that this file extension would be a logical thing for any operating system to have. Is it just because windows has .exe files and the Linux people wanted to be different? What is the rationale behind it? Also I noticed that there isn't any .txt files either why is this?

John VV 12-07-2014 05:05 PM

Because those are Microsoft Windows Binaries
they will not run on a linux OS

and linux is not windows
the same goes fro Apples Mac
apple will not run MICROSOFT software

well there is wine that is an emulator

Linux and UNIX and apple and sun do not use file extensions to DEFINE what a file is

but feel free to put .txt at the end of any plain text file if you want to

timl 12-07-2014 05:14 PM

Hmmmm, my experience of exe files goes back to OPENVMS (there is a link between DCL & DOS?). And these would not run on either MS or Linux software.

Linux has more in common with Unix systems where the bin file defines an executable. Someone more historically aware may be able to advise when Unix was first designed (1960s ?). I would guess though it was long before MS came into being.

jkl123 12-07-2014 05:21 PM

Maybe I should rephrase the question and ask it this way. Why doesn't Linux have its own file extension associated with executing a program such that when you double clicked on the file the program ran (the file extension could be .fge for example)?

astrogeek 12-07-2014 05:50 PM

Quote:

Originally Posted by jkl123 (Post 5281057)
Maybe I should rephrase the question and ask it this way. Why doesn't Linux have its own file extension associated with executing a program such that when you double clicked on the file the program ran (the file extension could be .fge for example)?

Rephrasing doesn't help.

The question is more akin to a former bicycle rider getting into a sports car and asking, "Why doesn't this thing have handlebars?". It is a fundamentally different machine.

Windows identifies binary files as being executable by the file extension, Linux/Unix does not.

Linux/Unix identify a file as being executable by the file permissions and the filename extension is irrelevant for that purpose.

File extensions such as .txt, .html, etc. may be used but have no inherent meaning to the operating system. Programs are usually associated with them by a method covered under the heading of "mime-types", I leave the searching for that term as an exercise.

jlinkels 12-07-2014 05:51 PM

Some historical and technical explanation.

Linux follows the Unix file attributes scheme. In the attributes it is set whether a file is executable, and by whom (user, group, others). If the file name starts with a dot, the file is hidden. Unix was designed and went into use in 1969.

DOS saw the first version in 1981. It used a highly simplified file system with simplified attributes. The visibility of the file was moved from the file name to the attribute. The executability of a file was moved from the attributes to the file name. (.EXE and .COM).

So if you talk about doing things different just because it seemed to be useful to deviate from other systems, ask why the DOS designer did that. (No, that was not Bill Gates). Same goes for using the backslash instead of forward slash in path names but that is out of the scope of this thread.

Then two other attributes were added to DOS files: the System and Archive attribute. The System attibute indicated whether a file was important for the system. DOS did not have file owners, so this was the mechanism to prevent deleting system files. The Archive attribute was a flag to signal whether the file was backed up or not. But it only worked with MS Backup.

jlinkels

Soadyheid 12-08-2014 06:13 AM

One of the reasons, though not the main one, that there are less viruses in Linux than Windows is because if you download a binary file in Linux, the executable flag is invariably NOT set. You'll have to manually set it to run it. Same with scripts. Windows can just run the .exe and you're stuffed!

As usual, this is always worth reading...

Play Bonny!

:hattip:

rtmistler 12-08-2014 07:56 AM

Linux has EXECUTABLE files, they just don't have the Microsoft/DOS extensions and further as pointed out, the files are compiled to run within the Linux OS versus another OS.

Unix never chose to have a need for a file extension and Linux has persisted with these conventions. Unix PRE-DATES Windows, so I would submit that DOS/Windows chose to add extensions. To go further, they did a horrific job with their original 8.3 file naming conventions too. All just my opinions there.

You technically could compile a source file into an executable for Linux and then choose to name it with a .EXE or .COM extension. It would be confusing to people, but that situation would run on your Linux system.

JeremyBoden 12-08-2014 08:14 AM

If you find it helpful, you could add .sh as a suffix to any executable scripts you create.
It won't bother Linux.

wpeckham 12-08-2014 08:21 AM

exe files?
 
Linux HAS exe files, they somply do not require any particular (or ANY) extension. Tht whole 8.3 thing was a bad choice from day one, but handy for crippled systems like IBMDOS and MSDOS that cannot detect file type or permissions directly. Check out the "file" command under Linux, or any flavor of Unix. You might also learn about the ACL system used under Linux. I think you will find it FAR more powerful and versital than the crippled extension' systems you describe.

Toadbrooks 12-08-2014 08:31 AM

Quote:

Originally Posted by timl (Post 5281055)
Linux has more in common with Unix systems where the bin file defines an executable. Someone more historically aware may be able to advise when Unix was first designed (1960s ?). I would guess though it was long before MS came into being.

Long before. Unix was created in 1969, more than 10 years before DOS. Linux and Unix let the contents of the file say how it is used, although as others have noted, the x bit in the permissions says whether it is executable or not.

As others have noted, you can include an extension, if you wish. (I do it, especially for files that I want to be readable to my friends who use Windows) But that doesn't allow or deny anything to Linux about how the file is used or what to do with it.

Sometimes Unix/Linux people aren't as gentle with with former Windows people as we could be. That always reminds me of early programming, when machine language programmers looked down on high-level language programmers. (I was one.) We tended to look down on people who needed the crutch of a high-level language saying, "Real Programmers don't need compilers. We program right down on the bare metal in 1s and 0s."

Of course, the crutch won, and the crutch of Windows has out-performed Unix and Linux, at least in terms of market-share.

It takes some getting used to, but Unix/Linux is simple in its own way. If you go to your home directory (/home/<username>) you can use the Linux equivalent of the DIR command (ls -la | more) and see all your files. We have 'dot' files too, and files that begin with a 'dot' are the equivalent of DOS's Hidden files. (They only appear if you include the 'a' in the 'ls -la' command above.) You may see files with extensions. I have a 'pic.jpeg' in mine as well as a 'killcore.sh'.) The files with the '.sh' extensions are the equivalent of .BAT files in DOS, although there is more than one shell in Linux/Unix, and there are more extensions, for example, .csh, .ksh, .bash, and .zsh.

There is plenty to learn, but it isn't that difficult. Experiment, use Google, read help files and ask questions. I think you'll eventually see that it's more consistent than the way Windows has had to change and adapt as computers became more powerful.

schneidz 12-08-2014 09:14 AM

http://www.linuxquestions.org/questi...ml#post5200740

jpollard 12-09-2014 08:25 AM

First use of "exe" extension as executable I saw was on a PDP-10 with Tops-10...In 1973. Turned out it actually came from DEC OS-8. The exe was produced by the compilers... and the com was a renamed exe but allowed it to interface with the command interpreter using the appropriate library calls to access the command parameters. And that went back to around 1968.

The style was taken by RT-11, and then to CP/M and its descendants.

Using permission bits to identify executables is much more secure.

neerajkolte 12-09-2014 09:54 AM

I saw this...
www.howtogeek.com - mime-types-explained-why-linux-and-mac-os-x-dont-need-file-extensions
Also..
www.howtogeek.com - magic-numbers-the-secret-codes-that-programmers-hide-in-your-pc
might be useful.

Thanks.


All times are GMT -5. The time now is 06:55 PM.