There is a magic number associated with each binary file , does anyone know how to retrieve this information from the file?
There is a file command which in turn uses a magic library, the magic library reads from a file found in /etc called magic
(this is installation dependant and may vary), which details what are the first few bytes of the file and tells the file
what kind of a file it is, be it, jpg, binary, text, shell script. There is an old version of libmagic found on sourceforge. Incidentally, there is a related answer to this here.
Hope this helps, Best regards, Tom.