xdg-mime

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

Install

All systems
curl cmd.cat/xdg-mime.sh
Debian Debian
apt-get install xdg-utils
Ubuntu
apt-get install xdg-utils
Alpine
apk add xdg-utils
Arch Arch Linux
pacman -S xdg-utils
image/svg+xml Kali Linux
apt-get install xdg-utils
CentOS
yum install xdg-utils
Fedora
dnf install xdg-utils
Windows (WSL2)
sudo apt-get update sudo apt-get install xdg-utils
Raspbian
apt-get install xdg-utils
Docker
docker run cmd.cat/xdg-mime xdg-mime powered by Commando

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

© tl;dr; authors and contributors