file View File Types
1 , command format
file [options] File ...
2 , command functions
This command is used to identify file types and to identify the encoding format of some files. It is to get the file type by looking at the header information of the file .
3 , common parameters
- b : Only the file identification results are listed and the file name is not displayed.
- F : View file types for file names in files, typically for Shell Programming
- I. : To MIME type to display the type of file
- Z : Try to interpret the contents of a compressed file
- F : Replaces the default ":" Delimiter after the output file name with the specified separator symbol.
- L : View file types for corresponding soft link files
4 , use instances
1 to view the corresponding file type for the specified file
command: File File
[[Email protected]~]# file inittab inittab:ascii 中文版 text[[email protected]~]# file test test:ascii text[[email Protec ted]~]# file Test inittab test:ascii textinittab:ascii 中文版 text[[email protected]~]#
2 , to MIME format to view file types
command: file-i File
[Email protected]~]# file-i inittab Inittab:text/plain; Charset=us-ascii[[email protected]~]#
3 , displays the file type specified in the file
command: file-f File
[Email protected]~]# cat test bashrc[[email protected]~]# file-f test. Bashrc:ascii Text[[email protected]~]#
4 , displays the file type of the corresponding soft connection
command: file-l Link_file
[Email protected]~]# file/dev/cdrom/dev/cdrom:symbolic link to ' sr0 ' [[Email protected]~]# file-l/dev/cdrom/dev/cdrom : Block Special[[email protected]~]# file/dev/sr0/dev/sr0:block special[[email protected]~]#
5 , try to interpret the compressed file
[[Email protected]~]# tar zcf test.tar.gz. *//To package and compress the files in the current directory into GZ format [e-mail protected]~]# lsinittab test test.tar.gz[[e Mail protected]~]# file-z test.tar.gz Test.tar.gz:POSIX tar archive (GNU) (gzip compressed data, from Unix, last modified : Tuedec 10:57:10) [[Email protected]~]# file test.tar.gz test.tar.gz:gzip compressed data, from Unix, last Modifie D:tue Dec 10:57:10 2016[[email protected]~]#
This article is from "Linux rookie" blog, please be sure to keep this source http://geekb0y.blog.51cto.com/10743719/1884184
One day a linux base command view file type