当前位置: 技术问答>linux和unix
linux 是怎么判断文件类型的?在线等待
来源: 互联网 发布时间:2015-02-03
本文导语: linux 是怎么判断文件类型的?比如说linux怎么直到一个文件是二进制的可执行文件,另一个是文本的脚本文件.好像不是根据文件的后缀呀? | # man file . . . File tests eac...
linux 是怎么判断文件类型的?比如说linux怎么直到一个文件是二进制的可执行文件,另一个是文本的脚本文件.好像不是根据文件的后缀呀?
|
# man file
. . .
File tests each argument in an attempt to classify it.
There are three sets of tests, performed in this order:
filesystem tests, magic number tests, and language tests.
The first test that succeeds causes the file type to be
printed.
The type printed will usually contain one of the words
text (the file contains only printing characters and a few
common control characters and is probably safe to read on
an ASCII terminal), executable (the file contains the
result of compiling a program in a form understandable to
some UNIX kernel or another), or data meaning anything
else (data is usually `binary' or non-printable).
...
. . .
File tests each argument in an attempt to classify it.
There are three sets of tests, performed in this order:
filesystem tests, magic number tests, and language tests.
The first test that succeeds causes the file type to be
printed.
The type printed will usually contain one of the words
text (the file contains only printing characters and a few
common control characters and is probably safe to read on
an ASCII terminal), executable (the file contains the
result of compiling a program in a form understandable to
some UNIX kernel or another), or data meaning anything
else (data is usually `binary' or non-printable).
...
您可能感兴趣的文章:
本站(WWW.)旨在分享和传播互联网科技相关的资讯和技术,将尽最大努力为读者提供更好的信息聚合和浏览方式。
本站(WWW.)站内文章除注明原创外,均为转载、整理或搜集自网络。欢迎任何形式的转载,转载请注明出处。
本站(WWW.)站内文章除注明原创外,均为转载、整理或搜集自网络。欢迎任何形式的转载,转载请注明出处。