The unix file command uses a \"magic\" file database to determine which type of data a file contains, independently of the file\'s name or extension.
file
I
You can man magic for a description for how to create your own magic file. Then use file -C -m to compile it, and file -m to use it.
man magic
file -C -m
file -m