Finding Out File Types with file
If you come from a Windows or Macintosh background, you're probably used to accessing files and being able to see what type of files they areHTML files, GIFs, documents, or whatever. In Unix, though, you often can't tell the file type just by listing files or displaying directory contents. That's where file comes in handy, as shown in Code Listing 7.7.
To identify file types with file:
Not all files have the "magic" information associated with them that makes file work, but most do. Where they don't, you get a best-guess response, like the second response in Code Listing 7.7. Unfortunately, you can't tell by looking if it's definitive information or a guess, but if it's terse (as in the second response), take it with a grain of salt.
Code Listing 7.7. The file command provides useful information about what kind of data is in specific files.
[ejr@hobbes ejr]$ file /usr/bin/pico /usr/bin/pico: ELF 32-bit LSB executable, Intel 80386, version 1, dynamically ld [ejr@hobbes ejr]$ file temp.htm temp.htm: ASCII text [ejr@hobbes ejr]$