Documentation

xdg-mime – query and manage MIME type associations

xdg-mime is a command-line utility supplied with xdg-utils for querying file types and managing default application associations on Linux. It provides a standard way to determine how the desktop environment identifies a file and which application has been configured to open it.

MIME types identify content such as images, documents, audio files and web pages. Linux desktop environments use these identifiers together with application desktop entries to decide which programs should handle particular files. xdg-mime provides access to these settings without requiring users to navigate graphical configuration tools or manually edit MIME association files.

The utility is useful for troubleshooting unexpected file associations, configuring preferred applications and automating desktop settings. Applications are identified by their .desktop file names rather than executable names. Default handlers are subject to desktop environment policies, so a requested change may not always take effect.

This is free and open source software.

Key Features

  • Identify a file’s MIME type using the query filetype command.
  • Query the default application associated with a specified MIME type.
  • Set an application as the default handler for one or more MIME types.
  • Identify application handlers through their desktop entry identifiers.
  • Install custom MIME type definitions supplied as XML files conforming to the Shared MIME-info Database specification.
  • Remove previously installed MIME type definitions.
  • Support user-specific and system-wide MIME definition management.
  • Verify whether the desktop environment has accepted a requested default application.
  • Integrate with desktop environments that implement freedesktop.org specifications.
  • Provide diagnostic output through the XDG_UTILS_DEBUG_LEVEL environment variable.
  • Support scripting and automation of file association settings.

Website: gitlab.freedesktop.org/xdg/xdg-utils
Support:
Developer: freedesktop.org
License: MIT License

xdg-mine man page


Related Software

Default Application and MIME Association Tools
xdg-mimeQuery MIME types and manage default application associations
handlr-regexManage default applications using regular expressions
Select Default ApplicationGraphical tool for managing default MIME type applications
MimicManage default applications and their file associations
xdgctlTerminal interface for managing XDG default applications
mime-tuiKeyboard-driven terminal interface for MIME associations

Read our verdict in the software roundup.

Alternatives to file
filUnix file command written in Go
mimetypeDetermines the MIME type of files
xdg-mimePart of xdg-utils
TrIDIdentify file types from their binary signatures
binwalkSearch a given binary image for embedded files

Best Free and Open Source Software LinuxLinks helps you discover the best free and open source software for Linux. Explore our extensive collection of recommended applications, including alternatives to popular proprietary software.

We also publish software reviews, Linux tutorials, hardware reviews, free programming books and articles covering the wider open source community. Browse our Linux resources to discover more.

Know a useful free and open source Linux application we haven't covered? Suggest a program for inclusion.

Has your software been featured on LinuxLinks? Display one of our Featured on LinuxLinks badges on your website or GitHub README.
Subscribe

Please read our Comment Policy before commenting.

Notify of
guest
0 Comments
Oldest
Newest Most Voted