The perl module File::MMagic guesses the file type from its contents like the file(1) command. from Alexander Bluhm <alexander_bluhm@genua.de>