LinuxCommandLibrary

update-desktop-database

TLDR

Update the MIME type cache for the default directories

$ sudo update-desktop-database
copy
Update cache for a specific directory
$ update-desktop-database [path/to/applications]
copy
Update in quiet mode (suppress output)
$ update-desktop-database -q
copy
Update with verbose output
$ update-desktop-database -v
copy
Update after installing a new .desktop file
$ sudo update-desktop-database /usr/share/applications
copy

SYNOPSIS

update-desktop-database [-q|--quiet] [-v|--verbose] [DIRECTORY...]

DESCRIPTION

update-desktop-database builds a cache database of MIME types handled by desktop files. The cache contains a mapping between MIME types and the desktop files (applications) that can handle them.
This cache enables applications to quickly find which programs can open files of a specific MIME type without parsing every .desktop file on the system. The cache is stored in mimeinfo.cache within each applications directory.
If no directory is specified, the command processes desktop files in the standard XDG data directories ($XDGDATADIRS/applications), typically /usr/share/applications and /usr/local/share/applications.
The command should be run after installing, removing, or modifying .desktop files to ensure the MIME type associations are current. Package managers typically run this automatically during software installation.

PARAMETERS

-q, --quiet

Do not display any information about processing and updating progress.
-v, --verbose
Display detailed information about processing and updating progress.
-h, --help
Display help message and exit.

CAVEATS

Invalid MIME types in desktop files are silently ignored. The cache only determines which applications can handle a MIME type; the preferred application order is controlled by external mechanisms like xdg-mime or desktop environment settings. Running without appropriate permissions for system directories will fail.

HISTORY

update-desktop-database is part of the desktop-file-utils package from the freedesktop.org project. It was developed to support the Desktop Entry Specification, which standardizes how applications are described and launched in Linux desktop environments. The tool has been a standard component of Linux desktop systems since the early 2000s.

SEE ALSO

> TERMINAL_GEAR

Curated for the Linux community

Bmax Mini PC B2 Power Intel 5205U 8GB DDR4 256GB M.2 NVMe SSD ,HDMI 1.4&DP 1.2, USB3.2,4K Dual Display 2.4G/5G WiFi & BT5.0 Mini Desktop Computers /Office/Design

Bmax Mini PC B2 Power Intel 5205U 8GB DDR4 256GB M.2 NVMe SSD ,HDMI 1.4&DP 1.2, USB3.2,4K Dual Display 2.4G/5G WiFi & BT5.0 Mini Desktop Computers /Office/Design

$169.99
Lenovo Gen 13 ThinkPad X1 Carbon Touchscreen Laptop with Intel Ultra 7 265U Processor, 14" WUXGA 100% sRGB, 32GB DDR5 RAM, 1TB NVMe Performance SSD, FHD+ IR+ RGB Camera, and Windows 11 Pro

Lenovo Gen 13 ThinkPad X1 Carbon Touchscreen Laptop with Intel Ultra 7 265U Processor, 14" WUXGA 100% sRGB, 32GB DDR5 RAM, 1TB NVMe Performance SSD, FHD+ IR+ RGB Camera, and Windows 11 Pro

$1,589.00
New Raspberry Pi 3 Model B+ Board Raspberry PI 3B+

New Raspberry Pi 3 Model B+ Board Raspberry PI 3B+

$54.00
Copied to clipboard

> TERMINAL_GEAR

Curated for the Linux community

Raspberry Pi 5 8GB

Raspberry Pi 5 8GB

$134.50
nuphy Air75 V2 Portable 75% Mechanical Keyboard,Wireless Keyboard

nuphy Air75 V2 Portable 75% Mechanical Keyboard,Wireless Keyboard

$129.95
New Raspberry Pi 3 Model B+ Board Raspberry PI 3B+

New Raspberry Pi 3 Model B+ Board Raspberry PI 3B+

$54.00