Have to know

File Extension and File Format

Computers cannot identify the file format based on the file extension, they parse the file to confirm if its parsed result matches file signature.


How to know the Actual Format

Use file command

Under Linux, you can use the file command.

file binfile

Example Output:

binfile: JPEG image data, JFIF standard 1.01, resolution (DPI), density 96x96, segment length 16, baseline, precision 8, 768x576, frames 3

It completely ignores the file extension, but rather relies on information in the file header.



View Files in Hexadecimal

  • windows
    Use hex editors, such as UltraEdit, winhex, etc.

  • macOS
    use the hexdump command.
    hexdump -C binfile | less

Reference

The header of different file signature: https://filesignatures.net/