How are file types known if not from file suffix?You are right in how you explained the behavior of file. It does in fact make an analysis of the file. However, most file types are identified by a header of sorts. 0000000: 7f45 4c46 0201 0100 0000 0000 0000 0000 .ELF............ is a header of an ELF executable (first few bytes of /bin/ls). Similarly #!/bin/bash at the top of an ASCII file would identify it as a shell script. Another example: 0000000: 8950 4e47 0d0a 1a0a 0000 000d 4948 4452 .PNG........IHDR (a .png image)