Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

How does the system identify an executable file from a data file or a media the system just looking for known extensions or is there something more low level that determines whether its executable...just to know out of curiosity

share|improve this question
up vote 2 down vote accepted
  • Windows: It just look file extension. Any .exe file extension will be treated as an executable.

  • Linux: It is a user choice. any file can be whathever the user want. First of all, an executable file must have +x attribute for the current user, after that, if the user want to execute the file, a shell must be used. Typing "./file" on a shell command will execute the file using the default system shell.

share|improve this answer
I'd suggest an edit myself, but it's less than 6 characters but … threat != treat ;). It's a nice typo in the given context though :) – Jonas Wielicki Jul 24 '12 at 12:13
If you run xclock by clicking a desktop icon - is a shell involved? – RedGrittyBrick Jul 24 '12 at 12:14
For windows it is not just the extension. The OS also checks the first two bytes for the magic number 4D 5A. In ASCII this woul be MZ, the initials of Mark Zbikowski. He is the engineer that initially came up with the exe format for MS-DOS. – EBGreen Jul 24 '12 at 12:24
but in windows also there are .bat files .com files etc right... – sujith1406 Jul 24 '12 at 12:25
.bat, .com, .vbs and .ps1 are script-oriented files. They are recognized by it's extension to run over the related program. (.bat and .com run on cmd; .vbs run on CScript; and .ps1 run over PowerShell interpreter). – Diogo Jul 24 '12 at 12:27

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .