WriteBash - Sometimes while working with Linux systems, you will see the type of file that you may have never known before.
Linux supports you with a command you can determine the type of file. This command is quite simple but it can be useful for you in some cases.
Show type of file with “file” command
As you can see, the name of the command says its meaning, the
file command is used to determine the type of the file.
The simplest is to call the
file command and the name of the file you need to determine behind that.
The example below, I will determine the type of file
install.log – this is a common file when you install CentOS virtual servers. The results showed that this is an ASCII text file.
So what if you want to check what kind of file is in a compressed file? In this case, we will use the
-z parameter in the file command.
- -z: try to look inside compressed files.
In the example below, I have compressed the
install.log file into a compressed file named
install.zip. When we use the
file command to test the compressed file, it returns the result as a zip file. But when we use the parameter
-z, it will return results about the type of files inside compressed files.
For the other parameters of the file command, type:
File commands can be very simple (I’m trying to talk about the simplest thing) but it can be very helpful for you in the future. For example, you download a compressed file for installation, but you do not know what exactly is inside the compressed file. When you extract the file, can you spread the virus? I suppose so, then the
file command will help you somewhat in this case.
If you appreciate what we share in this blog, you can support us by:
- Stay connected to: Facebook | Twitter | Google Plus | YouTube
- Subscribe email to recieve new posts from us: Sign up now.
- Start your own blog with SSD VPS - Free Let's Encrypt SSL ($2.5/month).
- Become a Supporter - Make a contribution via PayPal.
- Support us by purchasing Ribbon Lite Child theme being using on this website.
We are thankful for your support.