HiveBrain v1.2.0
Get Started
← Back to all entries
snippetbashTip

xdg-mime — Query and manage MIME types according to the XDG standard. More information: <https://portland.freed

Submitted by: @import:tldr-pages··
0
Viewed 0 times
commandxdg-mimeandmimeclimanagequerytypes
linux

Problem

How to use the xdg-mime command: Query and manage MIME types according to the XDG standard. More information: <https://portland.freedesktop.org/doc/xdg-mime.html>.

Solution

xdg-mime — Query and manage MIME types according to the XDG standard. More information: <https://portland.freedesktop.org/doc/xdg-mime.html>.

Display the MIME type of a file:
xdg-mime query filetype {{path/to/file}}


Display the default application for opening PNGs:
xdg-mime query default {{image/png}}


Display the default application for opening a specific file:
xdg-mime query default $(xdg-mime query filetype {{path/to/file}})


Set imv as the default application for opening PNG and JPEG images:
xdg-mime default {{imv.desktop}} {{image/png}} {{image/jpeg}}

Code Snippets

Display the MIME type of a file

xdg-mime query filetype {{path/to/file}}

Display the default application for opening PNGs

xdg-mime query default {{image/png}}

Display the default application for opening a specific file

xdg-mime query default $(xdg-mime query filetype {{path/to/file}})

Set imv as the default application for opening PNG and JPEG images

xdg-mime default {{imv.desktop}} {{image/png}} {{image/jpeg}}

Context

tldr-pages: linux/xdg-mime

Revisions (0)

No revisions yet.