|Software||>||File identification software||>||File command|
file command has been a part of Unix distributions for many years.
The Debian manpage gives an overview of its functionality
The program source includes a database of heuristics for determining file types, which includes a variety of 'magic numbers' which characterise files. This database is not portable, but is potentially adaptable.