How to check the type of a file in Linux
In Linux, you can use the ‘file’ command to view the file type. Here is an example of using the ‘file’ command:
file 文件路径
You need to replace “file path” with the actual path of the file you want to view its type. After running the command, the system will provide detailed information about the file, including its type.
For instance, if you want to check the type of a file named “example.txt”, you can execute the following command:
file example.txt
After executing the command, the system will return output similar to the following:
example.txt: ASCII text
The output indicates that the type of the “example.txt” file is ASCII text.