【Linux命令每日一知】file--输出文件类型

2020-07-14 上海

file

用来显示文件的类型

man page: file — determine file type

参数选项

参数说明
-b简化输出,不输出文件名
-i输出文件对应类型mime
-L如果文件是链接文件,显示最终文件的信息
-f name_file处理name_file文件中所包含的文件名信息,逐行逐行读取
-z如果文件是压缩文件,则显示被压缩文件的类型,而不是仅仅显示压缩文件类型

示例

[root@localhost grub2]# file /bin/bash
/bin/bash: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.32, BuildID[sha1]=85e3da5a087950e7aaeb7893c056218a8874d2e5, stripped
[root@localhost grub2]# file /home/jiangjian/kernel/linux-3.10.61.tar.gz 
/home/jiangjian/kernel/linux-3.10.61.tar.gz: gzip compressed data, from Unix, last modified: Sat Nov 22 02:51:35 2014, max compression
[root@localhost grub2]# file -z /home/jiangjian/kernel/linux-3.10.61.tar.gz 
/home/jiangjian/kernel/linux-3.10.61.tar.gz: POSIX tar archive (gzip compressed data, from Unix, last modified: Sat Nov 22 02:51:35 2014, max compression)    
[root@localhost grub2]# file /home/jiangjian/1.html 
/home/jiangjian/1.html: ASCII text
[root@localhost grub2]# file -i /home/jiangjian/1.html 
/home/jiangjian/1.html: text/plain; charset=us-ascii
[root@localhost grub2]# 


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值