LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 10-22-2002, 11:53 PM   #1
Alasis
LQ Newbie
 
Registered: Jul 2002
Location: Bontoc, Mt. Province, Philippines
Posts: 24

Rep: Reputation: 15
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
 
Old 10-23-2002, 01:15 AM   #2
trickykid
LQ Guru
 
Registered: Jan 2001
Posts: 24,149

Rep: Reputation: 234Reputation: 234Reputation: 234
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
 
Old 10-23-2002, 01:22 AM   #3
dscribner
LQ Newbie
 
Registered: Oct 2002
Location: Arlington, TX
Posts: 2

Rep: Reputation: 0
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!
 
Old 10-23-2002, 01:29 AM   #4
moses
Senior Member
 
Registered: Sep 2002
Location: Arizona, US, Earth
Distribution: Slackware, (Non-Linux: Solaris 7,8,9; OSX; BeOS)
Posts: 1,152

Rep: Reputation: 48
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.
 
Old 10-23-2002, 01:42 AM   #5
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,331
Blog Entries: 55

Rep: Reputation: 3530Reputation: 3530Reputation: 3530Reputation: 3530Reputation: 3530Reputation: 3530Reputation: 3530Reputation: 3530Reputation: 3530Reputation: 3530Reputation: 3530
OT

Quote:
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.
I agree. Looking around for some fsckin Gnome deps I stumbled upon some sort of initative to even make it a core part of Gnome (dunno really, could be there already, see if I care). Actions based on extensions leads to anger, and anger leads to, ah well, yknow. Spose they haven't learnt anything from what tricks you can pull on wintendo.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
mystery of X performance hulf_slo Linux - Software 7 09-21-2004 10:00 PM
mystery jhon Linux - Networking 1 09-01-2004 10:38 AM
Apache mystery drphear Linux - Software 0 02-15-2004 05:25 PM
The font mystery MATJA_KAE_92 Linux - Newbie 1 02-02-2004 10:52 AM
Mystery Directories!!! j0hn0n1 Linux - Newbie 2 01-23-2003 10:33 AM


All times are GMT -5. The time now is 10:54 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration