Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
有时,我们得到一个大文件,但我们不知道它的文件类型。所以我们需要使用一个工具来查看文件的第一个字节以找出它的文件类型。
但是文件对于普通的文本编辑器来说太大了,我要等很久!
PS我需要工具,而不是代码。
你可以使用xxd:
xxd -l 10 your-file
这显示了前 10 个八位字节your-file
your-file
任何合理的 *nix 盒子上的工具是:
file
head
tail