How to tell binary from text files in linux

后端 未结 8 1031
[愿得一人]
[愿得一人] 2021-02-07 13:52

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

8条回答
  •  再見小時候
    2021-02-07 14:42

    file is still the command you want. Any file that is text (according to its heuristics) will include the word "text" in the output of file; anything that is binary will not include the word "text".

    If you don't agree with the heuristics that file uses to determine text vs. not-text, then the question needs to be better specified, since text vs. non-text is an inherently vague question. For example, file does not identify a PGP public key block in ASCII as "text", but you might (since it is composed only of printable characters, even though it is not human-readable).

提交回复
热议问题