Six file-related instances in Linux
GuideThe FILE command is used to identify the FILE type and identify the encoding format of some files. It obtains the file type by viewing the file header information, rather than determining the file type through the extension like Windows. This article describes six file-related instances in Linux.
IntroductionThe official explanation of file is:
- File-determinefiletype
That is to say, it can identify the meaning of the file type, and can also be used to identify the encoding formats of some files. It obtains the file type by viewing the file header information, rather than determining the file type through the extension like in Windows, so it doesn't matter who will fall in love with the extension, speaking of Windows, let's not talk about it.
Instance
The following are some practical examples.
Instance 1: DefaultFile and then directly follow the file to obtain the following information:
- ➜Filebook.pdf
- Delete.pdf: Invalid document, version1.3
- ➜ Filebook
- Delete: Invalid document, version1.3
It can be seen that no suffix is added.
Instance 2: NO NAME IS DISPLAYED
- ➜File-bbook.pdf
- Invalid document, version1.3
The-B parameter indicates the meaning of brief. Only the file identification results are displayed, but the file name is not displayed. This is not very friendly for many files.
Example 3: Output easy-to-understand information
- ➜File-idelete.pdf
- Delete.pdf: application/pdf; charset = binary
The-I parameter is the meaning of the mime type. I don't know what it means, but I can easily understand the meaning of the file type I want to know. That's enough, isn't it? After all, we use the file command.
Example 4: view the file name information in the file
- ➜Cathello.txt
- Sunset.jpg
- ➜File-fhello.txt
- Sunset.jpg: Invalid imagedata, jsf-standard1.01
This is actually very simple. It is not difficult to add the-f parameter to the definition of the file-from type. What exactly does it mean, that is, if you want to view the file type information, the file name is located in a file. You can read the file information from this file as follows.
Example 5: Good-looking chicken ribs
- Export file-F "=" sunset.jpgsunset.jpg = export imagedata, JFIFstandard1.01
To tell the truth, I didn't understand what the function is. The default one is: It feels quite helpful. Of course, this should be customized, as shown below:
Instance 6: view the file information of the soft link
- Export filea.jpga.jpg: symboliclinkto'sunset.jpg'your file-la.jpga.jpg: Your imagedata, j1_standard1.01
By default, if there is no L parameter, you can only obtain the soft link information of the file. If you add this parameter, you can see the file information of the source file. This function is very good.
Address: http://www.linuxprobe.com/linux-six-file.html