Linux is full of Mystery
Its been a while that ive been using RH Linux 7.3 and im just wondering why I couldnt even see any .exe or .com files within the directories.
How could it be possible for the files to run (even without the extensions of .exe or .com) Sincerely Yours; IAn ACe |
extensions aren't really needed in the *nix world. its not like windows and the way the filesystem is setup. most of the time extensions are used only so you know what type of file it is. i tend to use extensions on either image files like .jpg, .png.. , html files, and perl files.. .pl
|
File "extensions" are a "DOS" thing. In the early days of DOS, executable files had extensions of either .COM, .EXE or .BAT (and with priorities in that order). That was the only way to identify an executable file, by the extension (of course, the file actually had to be executable, or in the case of batch files, contain valid DOS and/or commands). These "properties" carried over into Windows, of course, as that is the structure that the Windows OS is built on.
In the *NIX world, file extensions aren't necessary. Files are identified as being executable if they have the "x" permissions set (as in "rwx"). If the permissions have been set for that particular user, the user could then read the file (if "r" is set), write the file (if "w" is set), or execute the file (if "x" is set), and these permissions exist for the owner (user), group and others. Of course, for the file to execute properly, it would have to be a compiled binary executable, or a script that would then be interpreted by a shell (bash, ksh, tsch, etc.) or other language interpreter (like Perl or Ruby). You may find that without an extension, if you were to try and "open" a file Windows will ask you what to open the file with, and without either a .COM, .EXE or .BAT extension, it won't even run. With Linux, as long as it's been assigned a permission of executable, it will certainly try to (whether it does or not depends not on any extension, but the contents). HTH! |
The filesystem (and file typing) doesn't work the same under linux and
'doze. Under MS, the extension of an 8.3 file defines what the file is, and the OS treats it as being that kind of file (.exe => executable). However, under linux (and any other decent OS), there are a few bytes at the beginning of a file that defines what it is (the magic number). Those bytes exist in almost all files, but MS ignores them. The magic number tells the OS what it should do with the file. If its magic number defines it as a "binary executable", then the OS will try to treat it as such. It doesn't matter what the file is named, it could be named Foo.jpg and still be a binary executable file. This really frees the users to name their files with much more reasonable and useful names (that and long filenames). It also gets around the problem of getting confused by a filename extension. There happens to be a table in /etc/magic (usually) that basically gives the definitions of filetypes, and with this table and a cool program called "file" you can find out what kind of file you have, regardless its name. do a: file /etc/magic This should give you : /etc/magic: magic text file for file(1) cmd So, the upshot of this is that you shouldn't expect to see files with the .exe extension, as the filename extension is basically meaningless to the OS. There are some distros and window managers that are perverting this and looking at the filename to make decisions about the file. This is pure sloppiness on the programmer's part. |
OT
Quote:
|
All times are GMT -5. The time now is 02:22 PM. |