Linux command
mimetype 命令
文件
复制后可按需替换文件名、目录或参数。
常用示例
Example
mimetype [path/to/file]
Example
mimetype --brief [path/to/file]
Example
mimetype --describe [path/to/file]
Example
[command] | mimetype --stdin
Example
mimetype --debug [path/to/file]
Example
mimetype --all [path/to/file]
Example
mimetype --language [path/to/file]
说明
mimetype determines the MIME type of files using the shared-mime-info database. It examines file contents (magic bytes) and filename patterns to identify the type, similar to the file command but outputting standard MIME types. The tool is part of the File::MimeInfo Perl module and uses the freedesktop.org shared MIME database. It can detect thousands of file types including documents, images, audio, video, and application-specific formats. Unlike simple extension-based detection, mimetype examines actual file contents, making it more reliable for files with incorrect or missing extensions.
参数
- --brief, -b
- Output only the MIME type without the filename
- --describe, -d
- Output a human-readable description of the MIME type
- --stdin, -i
- Read data from standard input instead of a file
- --debug, -D
- Show debugging information about type detection
- --all, -a
- List all possible MIME types with confidence scores
- --language _code_
- Set the output language using a 2-letter code
FAQ
What is the mimetype command used for?
mimetype determines the MIME type of files using the shared-mime-info database. It examines file contents (magic bytes) and filename patterns to identify the type, similar to the file command but outputting standard MIME types. The tool is part of the File::MimeInfo Perl module and uses the freedesktop.org shared MIME database. It can detect thousands of file types including documents, images, audio, video, and application-specific formats. Unlike simple extension-based detection, mimetype examines actual file contents, making it more reliable for files with incorrect or missing extensions.
How do I run a basic mimetype example?
Run `mimetype [path/to/file]` in a terminal, then adjust file names, paths, flags, or remote targets for your system.
What does --brief, -b do in mimetype?
Output only the MIME type without the filename