I would like to gain a deeper understanding of mime-types. So far I understand the following thanks to @munzir-taha

It is normal to have different mime-type file associations on different systems, even when those systems are running the same version of the same distro and even if the user didn't customize any mime associations. This is because the associations depend on the packages installed in each system and maybe the order in which they were installed.

I also understand that a user can add or remove mime-type associations with either of these methods:

  1. manually edit ~/.config/mimeapps.list

  2. using GUI tools. In KDE, this could be done in System Settings or via Dolphin (e.g., right-click the file > Properties > File Type Options and associate the file type with your desired app)

However, I wish to dig deeper into this. I'm running Arch Linux and KDE. I created a new user account for testing. It has the following properties:

The package shared-mime-info is installed:

sudo pacman -Qs shared-mime-info
local/shared-mime-info 1.15-2
    Freedesktop.org Shared MIME Info

Public keys have the mime-type text/plain:

$ xdg-mime query filetype id_rsa_test.pub

The default handler for text/plain is Atom editor:

$ xdg-mime query default text/plain

There is no mimeapps.list for this user. The typical file is not present (as shown below) and there are no other mimeapps.list files in this user account.

$ less ~/.config/mimeapps.list
/home/deleteme/.config/mimeapps.list: No such file or directory

The system appears to have a system-wide association for .pub files with the mime-type application/vnd.ms-publisher. This file is present on the system:


The contents of the above file include a glob pattern for .pub files:

<?xml version="1.0" encoding="utf-8"?>
<mime-type xmlns="http://www.freedesktop.org/standards/shared-mime-info" type="application/vnd.ms-publisher">
<!--Created automatically by update-mime-database. DO NOT EDIT!-->
<sub-class-of type="application/x-ole-storage"/>
<glob pattern="*.pub"/>

Why is the above mime-type not determining the result of this query?

$ xdg-mime query filetype id_rsa_test.pub

From what I already know, I would expect that a mimeapps.list local to the user would be responsible for that association, but there is not any such file.

I do not find any other association for .pub files on this system. As I mentioned, there is no mimeapps.list for this new user account.


The system appears to have a system-wide association for .pub files with the mime-type application/vnd.ms-publisher

You haven't provided any proof for this. In the contrary, your xdg-mime query filetype id_rsa_test.pub showed text/plain which is the system-wide association if this is really a newly created user with no customization whatsoever.

Why is the above mime-type not determining the result of this query?

Depending on the packages installed on your system and the configurations, your system would decide how to recognize the mimetype. In your case, your system most likely determined the type not by checking for extension '.pub', but by checking the magic code which is the contents of the file.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.