linux下file命令使用技巧

1.    windows以不一樣的擴展名來區分不一樣的文件,例如:.exe .pnglinux

2.    linux下對擴展名沒有明確的要求有時就會遇到各類坑,當咱們不知道是一個壓縮文件,用一些命令查看的時候,會出現各類亂碼windows

[root@qyn ~]# cat text |head                                  Y8о+ub.°@¤q:%DURr)Xs±O§Ld2§2cide

  

3.    file來查看文件類型spa

[root@qyn ~]# file textip

text: gzip compressed data,from Unix, last modified: Wed Aug 23 23:10:14 2017it

[root@qyn ~]#io

4.    由此能夠看出,這是個壓縮文件,可使用,tar -tf查看table

[root@qyn ~]# tar -tftextast

etc/servicesclass

[root@qyn ~]#

5.    對於一沒有擴展名的文件,能夠用file查看文件類型

[root@qyn ~]# file /bin/ls /etc/hosts ser.tar.gz

/bin/ls:    ELF 64-bit LSB executable, x86-64, version 1(SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.18, stripped

/etc/hosts: ASCIItext

ser.tar.gz: gzipcompressed data, from Unix, last modified: Wed Aug 23 23:10:14 2017

[root@qyn ~]#

相關文章
相關標籤/搜索