mirror of
https://github.com/fofolee/uTools-Manuals.git
synced 2025-06-08 23:14:06 +08:00
48 lines
2.1 KiB
HTML
48 lines
2.1 KiB
HTML
<h1 id="file">file</h1>
|
||
<p>用来探测给定文件的类型。</p>
|
||
<h2 id="补充说明">补充说明</h2>
|
||
<p><strong>file命令</strong> 用来探测给定文件的类型。file命令对文件的检查分为文件系统、魔法幻数检查和语言检查3个过程。</p>
|
||
<h3 id="语法">语法</h3>
|
||
<pre><code class="language-bash">file(选项)(参数)</code></pre>
|
||
<h3 id="选项">选项</h3>
|
||
<pre><code class="language-bash">-b:列出辨识结果时,不显示文件名称;
|
||
-c:详细显示指令执行过程,便于排错或分析程序执行的情形;
|
||
-f<名称文件>:指定名称文件,其内容有一个或多个文件名称时,让file依序辨识这些文件,格式为每列一个文件名称;
|
||
-L:直接显示符号连接所指向的文件类别;
|
||
-m<魔法数字文件>:指定魔法数字文件;
|
||
-v:显示版本信息;
|
||
-z:尝试去解读压缩文件的内容。</code></pre>
|
||
<h3 id="参数">参数</h3>
|
||
<p>文件:要确定类型的文件列表,多个文件之间使用空格分开,可以使用shell通配符匹配多个文件。</p>
|
||
<h3 id="实例">实例</h3>
|
||
<p>显示文件类型</p>
|
||
<pre><code class="language-bash">[root@localhost ~]# file install.log
|
||
install.log: UTF-8 Unicode text
|
||
|
||
[root@localhost ~]# file -b install.log <== 不显示文件名称
|
||
UTF-8 Unicode text
|
||
|
||
[root@localhost ~]# file -i install.log <== 显示MIME类别。
|
||
install.log: text/plain; charset=utf-8
|
||
|
||
[root@localhost ~]# file -b -i install.log
|
||
text/plain; charset=utf-8
|
||
</code></pre>
|
||
<p>显示符号链接的文件类型</p>
|
||
<pre><code class="language-bash">[root@localhost ~]# ls -l /var/mail
|
||
lrwxrwxrwx 1 root root 10 08-13 00:11 /var/mail -> spool/mail
|
||
|
||
[root@localhost ~]# file /var/mail
|
||
/var/mail: symbolic link to `spool/mail'
|
||
|
||
[root@localhost ~]# file -L /var/mail
|
||
/var/mail: directory
|
||
|
||
[root@localhost ~]# file /var/spool/mail
|
||
/var/spool/mail: directory
|
||
|
||
[root@localhost ~]# file -L /var/spool/mail
|
||
/var/spool/mail: directory
|
||
</code></pre>
|
||
<!-- Linux命令行搜索引擎:https://jaywcjlove.github.io/linux-command/ -->
|