Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

How does the system identify an executable file from a data file or a media file...is 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

1 Answer 1

up vote 1 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
3  
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

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.