How does linux recognize file types?

Hey ,

I was wondering how does Linux recognize file types if he doesn't use extensions to determine the file type ?

It's just a question not for a script or something else.

thnx:o

There is a program called file which uses a database of "magic numbers" ( /usr/share/magic) to determine the content-type of a file.

Thanks i just found on google the same answer

Unlike Windows, it has an executable bit to help tell programs apart from random files. But the kernel's job in detecting file types is fairly easy. Executables and libraries start with "\7fELF". Script files begin with #!. Anything else won't go.