The linux file
command does a very good job in recognising file types and gives very fine-grained results. The diff
tool is able to tell binary files f
The diff manual specifies that
diff determines whether a file is text or binary by checking the first few bytes in the file; the exact number of bytes is system dependent, but it is typically several thousand. If every byte in that part of the file is non-null, diff considers the file to be text; otherwise it considers the file to be binary.