mimetype
The "mimetype" command line tool is used to determine the type of a file by examining its contents. It is primarily used on Unix-like systems. The tool relies on a database of file signatures and uses them to identify the file type. The database is stored in "/etc/mime.types" file.
When the "mimetype" command is executed with a file as an argument, it reads the file and matches its contents against the signatures in the database. It then returns the corresponding MIME type. This can be useful for various purposes such as verifying file integrity or handling different types of files appropriately in a script or program.
The command also has additional options to display the human-readable description of the MIME type or to output the file's type as a string without any additional information. It can also be used in combination with other tools or commands to perform more complex tasks based on file types.
The "mimetype" command is lightweight, efficient, and widely available in many Unix-like operating systems including Linux. It provides a quick and reliable way to determine the type of a file based on its content rather than relying solely on the file extension.
List of commands for mimetype:
-
mimetype:tldr:0106d mimetype: Display all the possible MIME types of a given file in confidence order.$ mimetype --all ${filename}try on your machineexplain this command
-
mimetype:tldr:20f4c mimetype: Print the MIME type of a given file.$ mimetype ${filename}try on your machineexplain this command
-
mimetype:tldr:22b05 mimetype: Explicitly specify the 2-letter language code of the output.$ mimetype --language ${filename}try on your machineexplain this command
-
mimetype:tldr:3e6a6 mimetype: Display debug information about how the MIME type was determined.$ mimetype --debug ${filename}try on your machineexplain this command
-
mimetype:tldr:5dad3 mimetype: Display only the MIME type, and not the filename.$ mimetype --brief ${filename}try on your machineexplain this command
-
mimetype:tldr:a3769 mimetype: Display a description of the MIME type.$ mimetype --describe ${filename}try on your machineexplain this command