
You can examine the uncompressed contents to decide the file type with -z option. If you gzip a directory and now you have a compressed file. Get file type info of a file inside an archive file Here’s an example of the command on a video file, with and without MIME type info: :~/$ file my_video.mp4 You can also display the MIME type of the file thanks to the -i option. Have a look at the same example you saw earlier: :~/$ file -b cpluplus.cppĬ++ source, ASCII text Get the mime type of the file You can use the option -b and the output will show only the file type omitting the filename. Let’s see some other ways you can use it with its options. Here’s an example: :~/$ file cpluplus.cpp In its simplest form, you can use the file command with filename or path to file and it will show the type of the file.

#How to make a new file without extension in linux how to
Now that you know the syntax, let’s see how to use file command. It has a simple syntax with only a few options: file filename The file command in Linux determines the actual type of a file, no matter what its extension is. The file command comes handy in such situations. You can choose to not use any extension at all. How do you recognize the type of a file? Let me guess, by its extension, right? I mean if you see a file named MyData.csv, you guess that the file is in CSV format.īut the file extensions in Linux and Unix have no real meaning. What is the file command in Linux and Unix? Let’s talk about the file command in this article. You have also seen the command to delete file in Linux. You have seen commands to create file in Linux.
