From ArchWiki
(Redirected from Xdg-open)

xdg-utils provides the official utilities for managing XDG MIME Applications.


Install the xdg-utils package.



See xdg-mime(1).

Determine a file's MIME type:

$ xdg-mime query filetype photo.jpeg

Determine the default application for a MIME type:

$ xdg-mime query default image/jpeg

Change the default application for a MIME type:

$ xdg-mime default feh.desktop image/jpeg

Debug default application for MIME type:

$ env XDG_UTILS_DEBUG_LEVEL=10  xdg-mime query default text/html
Checking /home/you/.config/mimeapps.list
Checking /home/you/.local/share/applications/defaults.list and /home/you/.local/share/applications/mimeinfo.cache
Checking /usr/local/share/applications/defaults.list and /usr/local/share/applications/mimeinfo.cache
Checking /usr/share/applications/defaults.list and /usr/share/applications/mimeinfo.cache


xdg-open is a resource opener that implements XDG MIME Applications and is used by many programs, see xdg-open(1) for the usage.

xdg-open is desktop-environment-independent in the sense that it attempts to use each environment's native default application tool.

If no desktop environment is detected, MIME type detection falls back to using file which—ironically—does not implement the XDG standard. If you want xdg-open to use XDG MIME Applications without a desktop environment, you will need to install perl-file-mimeinfo or switch to one of the resource openers that support XDG MIME Applications.


See xdg-settings(1).

Shortcut to open all web MIME types with a single application:

$ xdg-settings set default-web-browser firefox.desktop

Shortcut for setting the default application for a URL scheme:

$ xdg-settings set default-url-scheme-handler irc xchat.desktop

Tips and Tricks

URL scheme handlers

To set the default application for a URL scheme you may also need to change the default application for the x-scheme-handler/* MIME types:

$ xdg-mime default firefox.desktop x-scheme-handler/https x-scheme-handler/http