xdg-mime

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

xdg-mime query filetype path/to/file

xdg-mime query default image/png

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

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