LLMpediaThe first transparent, open encyclopedia generated by LLMs

xdg-mime

Generated by GPT-5-mini
Note: This article was automatically generated by a large language model (LLM) from purely parametric knowledge (no retrieval). It may contain inaccuracies or hallucinations. This encyclopedia is part of a research project currently under review.
Article Genealogy
Parent: Desktop Entry Spec Hop 5
Expansion Funnel Raw 50 → Dedup 0 → NER 0 → Enqueued 0
1. Extracted50
2. After dedup0 (None)
3. After NER0 ()
4. Enqueued0 ()
xdg-mime
Namexdg-mime
Titlexdg-mime
Developerfreedesktop.org
Released2004
LanguageEnglish
Operating systemLinux, FreeBSD
LicenseMIT License

xdg-mime xdg-mime is a command-line utility from the freedesktop.org suite used to query and set file type associations via the MIME (Multipurpose Internet Mail Extensions) system on Unix-like desktops. It provides a standardized interface for applications and scripts to determine default handlers for file types and to update the user-level MIME database, enabling interoperation among desktop environments such as GNOME, KDE, Xfce, and LXDE. The tool bridges desktop standards promulgated by freedesktop.org with implementation details in distributions produced by Canonical, Red Hat, Debian, and others.

Overview

xdg-mime operates within the ecosystem shaped by freedesktop.org specifications, POSIX-based platforms, and desktop environments including GNOME, KDE Plasma, Xfce, LXDE, MATE, Cinnamon, Budgie and distributions like Ubuntu, Fedora, Debian, Arch Linux, and openSUSE. It relies on MIME standards developed in contexts associated with IETF and MIME registration practices used by Thunderbird, Evolution, Firefox, and Chromium. The utility manipulates entries consistent with desktop entry specifications used by .desktop files and integrates with system components such as xdg-utils, glib, and the freedesktop.org MIME database.

Usage and Commands

xdg-mime provides verbs to query and set associations; common commands mirror operations found in tools like update-desktop-database and mimeopen. Typical subcommands include querying a file's MIME type, querying the default application for a MIME type, and setting the default application. Interactions occur with files like ~/.local/share/applications/*.desktop and system locations maintained by distributions such as Red Hat Enterprise Linux, SUSE Linux Enterprise, and Gentoo. Implementations must respect XDG base directories specified by projects like XDG Base Directory Specification and are used in automation by toolchains including systemd, Upstart, and configuration managers from Canonical and Red Hat.

Configuration and MIME Database

xdg-mime reads and updates the MIME database composed of shared-mime-info entries maintained by freedesktop.org and distributed via packages such as shared-mime-info in distributions like Debian, Ubuntu, Arch Linux, Fedora, and openSUSE. The database maps file name patterns and magic numbers to MIME types defined in registries like IANA and referenced by applications including VLC, GIMP, Inkscape, LibreOffice, and Evince. System integrators and packagers from organizations like Canonical and Red Hat install .desktop metadata in /usr/share/applications, while user-level overrides live in ~/.local/share/applications per the XDG Base Directory Specification. Tools such as update-mime-database and utilities maintained by freedesktop.org ensure that MIME caches and desktop entries stay synchronized across environments like KDE Plasma, GNOME, and Xfce.

Examples and Common Use Cases

Administrators and users employ xdg-mime to set default handlers for content viewed in applications such as Firefox, Chromium, Thunderbird, Evince, Okular, VLC, GIMP, LibreOffice, and Inkscape. Common examples include registering a default PDF viewer in GNOME or KDE Plasma sessions, associating audio types for Rhythmbox or Amarok, and scripting installer behavior for packages from Debian, Ubuntu, Fedora, Arch Linux and openSUSE. System integrators at organizations such as Canonical and Red Hat use it in post-install scripts; desktop developers at projects like KDE, GNOME, and Xfce use it to maintain consistent user experiences across distributions.

Compatibility and Desktop Integration

xdg-mime is designed to be desktop-agnostic, interacting with desktop environments including GNOME, KDE Plasma, Xfce, MATE, Cinnamon, LXDE, and Budgie. Integration points include handling .desktop files following freedesktop.org standards and cooperating with system services such as systemd user sessions and session managers provided by GNOME Session and KDE Plasma Workspace. Packaging and compatibility concerns arise in distributions like Ubuntu, Fedora, Debian, openSUSE, and Arch Linux, where maintainers reconcile distribution-specific application bundles (for example, Snapcraft, Flatpak, and AppImage) with legacy MIME handling. Projects like Flatpak require specific sandboxing rules that affect how xdg-mime changes are visible to sandboxed applications.

Security and Permissions

xdg-mime operates at the user level and respects file permissions and XDG directory rules enforced by platforms such as Linux kernel and user session managers in systemd. Changes made to MIME associations are typically confined to user-local directories like ~/.local/share/applications, limiting system-wide impact unless executed with elevated privileges in environments maintained by Debian, Ubuntu, Red Hat, or SUSE. Security considerations intersect with sandboxing technologies from Flatpak, permission models in Snapcraft, and desktop policy frameworks in KDE, GNOME, and Xfce. Supply-chain and packaging security concerns are addressed by maintainers and auditors at organizations such as freedesktop.org, Canonical, Red Hat, and distribution security teams.

Category:Freedesktop.org standards