开发者

See the header position of a BIG file [closed]

开发者 https://www.devze.com 2023-02-06 11:38 出处:网络
Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed. This question is off-topic. It is not currently accepting answers.

Want to improve this question? Update the question so it's on-topic for Stack Overflow.

Closed 11 years ago.

Improve this question

sometimes, we got a BIG file, but we don't know its file type. so we need to use a tool to peek the very first bytes of the file to find out its file type.

but the file is too big to the normal text editor, i have to wait for a long time!

P.S. I need tool开发者_如何学Gos, not the code.


The tools on any reasonable *nix box are:

  • file: knows a lot of magic headers and detects the type of a file.
  • head: reads first several lines or bytes of a file.
  • tail: reads last several bytes or lines of a file; some files have metainfo at the end.


You could use xxd:

xxd -l 10 your-file

This displays the first 10 octets of your-file

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号