To display the type of a file, and the info about the type you can use the command line file, this command shows you the type of file no matter the extension it may have. So it is really useful to know the type of file, and to know which tool you need to work with that file. Usage file [option] file-list
- -f file
- When specified, the file command takes the list of file from the file specified after the -f parameter, you need to enter one name per line in that text file
- Displays MIME file information, in MIME format
- Shows the info of the files being symbolic linked and the link itself
- Classify the files contained by a compressed file
file can recognize more than 5.000 file types but it is not always accurate or exact.
Write this insideSome text
And save the file now use file to discover the type of file it is.
This is the output.
[user@ggarron Desktop]$ file hola.tar.gz hola.tar.gz: HTML document text
As you can see, it is not guided by the file extension but for the content itself.