← 返回命令列表

Linux command

xdg-mime 命令

文件

复制后可按需替换文件名、目录或参数。

常用示例

Display

xdg-mime query filetype [path/to/file]

Display

xdg-mime query default image/png

Display

xdg-mime query default $(xdg-mime query filetype [path/to/file])

Set

xdg-mime default [imv.desktop] image/png image/jpeg

说明

xdg-mime queries and manages MIME types according to the XDG (freedesktop.org) standard. It can detect file types, query default applications, and set application associations. The tool integrates with the desktop environment's MIME type handling, storing user preferences in ~/.config/mimeapps.list.

参数

query filetype _file_
Display the MIME type of a file
query default _mimetype_
Display the default application for a MIME type
default _application_ _mimetype_...
Set default application for MIME types
install _mimetypes-file_
Install a MIME type definition
uninstall _mimetypes-file_
Uninstall a MIME type definition

FAQ

What is the xdg-mime command used for?

xdg-mime queries and manages MIME types according to the XDG (freedesktop.org) standard. It can detect file types, query default applications, and set application associations. The tool integrates with the desktop environment's MIME type handling, storing user preferences in ~/.config/mimeapps.list.

How do I run a basic xdg-mime example?

Run `xdg-mime query filetype [path/to/file]` in a terminal, then adjust file names, paths, flags, or remote targets for your system.

What does query filetype _file_ do in xdg-mime?

Display the MIME type of a file