Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 11 years ago.
Improve this questionsometimes, 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
精彩评论