命令简介:
该命令用来识别文件类型,也可用来辨别一些文件的编码格式。它是通过查看文件的头部信息来获取文件类型,而不是像Windows通过扩展名来确定文件类型的。
执行权限 :All User
指令所在路径:/usr/bin/file
命令语法:
file [ -bchikLnNprsvz ] [ -f namefile ] [ -F separator ] [ -m magicfiles ] file ...
命令参数:
下表列出了部分常用的参数。
| 参数 |
长参数 |
描叙 |
| -b |
列出文件辨识结果时,不显示文件名称。 |
|
| -c |
详细显示指令执行过程,便于排错或分析程序执行的情形 |
|
| -f |
列出文件中文件名的文件类型 |
|
| -F |
使用指定分隔符号替换输出文件名后的默认的“:”分隔符。 |
|
| -i |
输出mime类型的字符串 |
|
| -L |
查看对应软链接对应文件的文件类型 |
|
| -z |
尝试去解读压缩文件的内容 |
|
| --help |
显示命令在线帮助 |
|
| --version |
显示命令版本信息 |
使用示例:
1:查看file命令的帮助信息
[root@DB-Server ~]# file --help
讯享网
讯享网Usage: file [OPTION]... [FILE]...
Determine file type of FILEs.
讯享网
-m, --magic-file LIST use LIST as a colon-separated list of magic
讯享网 number files
-z, --uncompress try to look inside compressed files
讯享网 -b, --brief do not prepend filenames to output lines
-c, --checking-printout print the parsed form of the magic file, use in
讯享网 conjunction with -m to debug a new magic file
before installing it
讯享网 -f, --files-from FILE read the filenames to be examined from FILE
-F, --separator string use string as separator instead of `:'
讯享网 -i, --mime output mime type strings
-k, --keep-going don't stop at the first match
讯享网 -L, --dereference causes symlinks to be followed
-n, --no-buffer do not buffer output
讯享网 -N, --no-pad do not pad output
-p, --preserve-date preserve access times on files
讯享网 -r, --raw don't translate unprintable chars to \ooo
-s, --special-files treat special (block/char devices) files as
讯享网 ordinary ones
--help display this help and exit
讯享网 --version output version information and exit

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容,请联系我们,一经查实,本站将立刻删除。
如需转载请保留出处:https://51itzy.com/kjqy/125470.html