I'm running Arch Linux and KDE. I have installed Arch KDE on several devices and in the usual case there is no specific mime-type association for .pub files (which are public keys in my case). They will be opened by the default handler for plain text documents. This is what I expect to see on my standard Arch Linux install:
$ xdg-mime query filetype id_rsa_test.pub
text/plain
However, on my main desktop, .pub files are associated with ms-publisher.
$ xdg-mime query filetype id_rsa_test.pub
application/vnd.ms-publisher
I want to remove this association completely. Here are some of the places I found evidence of this association:
$ grep -irl '.pub' ./.local/share/mime/
./.local/share/mime/packages/application-vnd.ms-publisher.xml
./.local/share/mime/application/vnd.ms-publisher.xml
./.local/share/mime/globs
./.local/share/mime/globs2
./.local/share/mime/types
./.local/share/mime/mime.cache
$ sudo grep -irl 'ms-publisher' /usr
/usr/share/applications/mimeinfo.cache
/usr/share/mime/packages/freedesktop.org.xml
/usr/share/mime/application/vnd.ms-publisher.xml
/usr/share/mime/globs
/usr/share/mime/globs2
/usr/share/mime/subclasses
/usr/share/mime/types
/usr/share/mime/mime.cache
/usr/share/icons/breeze/mimetypes/64/application-vnd.ms-publisher.svg
/usr/share/icons/breeze/mimetypes/22/application-vnd.ms-publisher.svg
/usr/share/icons/breeze/breeze-icons.rcc
/usr/share/icons/breeze/icon-theme.cache
/usr/share/icons/breeze-dark/mimetypes/22/application-vnd.ms-publisher.svg
/usr/share/icons/breeze-dark/breeze-icons-dark.rcc
/usr/share/icons/breeze-dark/icon-theme.cache
/usr/lib/libreoffice/share/xdg/draw.desktop
According to the xdg-mime man page, the uninstall command might do the trick. In my case at least, the uninstall command has no effect.
# xdg-mime uninstall /usr/share/mime/application/vnd.ms-publisher.xml
# echo $?
0
# sudo grep -irl 'ms-publisher' /usr
/usr/share/file/misc/magic.mgc
/usr/share/applications/mimeinfo.cache
/usr/share/mime/packages/freedesktop.org.xml
/usr/share/mime/application/vnd.ms-publisher.xml
/usr/share/mime/globs
/usr/share/mime/globs2
/usr/share/mime/subclasses
/usr/share/mime/types
/usr/share/mime/mime.cache
/usr/share/icons/breeze/mimetypes/64/application-vnd.ms-publisher.svg
/usr/share/icons/breeze/mimetypes/22/application-vnd.ms-publisher.svg
/usr/share/icons/breeze/breeze-icons.rcc
/usr/share/icons/breeze/icon-theme.cache
/usr/share/icons/breeze-dark/mimetypes/22/application-vnd.ms-publisher.svg
/usr/share/icons/breeze-dark/breeze-icons-dark.rcc
/usr/share/icons/breeze-dark/icon-theme.cache
/usr/lib/libreoffice/share/xdg/draw.desktop
# grep -irl '.pub' /usr/share/mime/
/usr/share/mime/packages/freedesktop.org.xml
/usr/share/mime/packages/calibre-mimetypes.xml
/usr/share/mime/application/pkcs7-mime.xml
/usr/share/mime/application/pkcs8-encrypted.xml
/usr/share/mime/application/epub+zip.xml
/usr/share/mime/application/x-pkcs7-certificates.xml
/usr/share/mime/application/pkcs8.xml
/usr/share/mime/application/pkcs10.xml
/usr/share/mime/application/pkcs12.xml
/usr/share/mime/application/vnd.ms-publisher.xml
/usr/share/mime/globs
/usr/share/mime/globs2
/usr/share/mime/magic
/usr/share/mime/subclasses
/usr/share/mime/types
/usr/share/mime/generic-icons
/usr/share/mime/mime.cache
For my question, I want to know generally how to remove any mime-type association from my system using only CLI tools.
EDIT: response to answer:
On a new user account I show the following:
sudo pacman -Qs shared-mime-info
local/shared-mime-info 1.15-2
Freedesktop.org Shared MIME Info
$ xdg-mime query filetype id_rsa_test.pub
text/plain
$ xdg-mime query default text/plain
atom.desktop
$ less ~/.config/mimeapps.list
/home/deleteme/.config/mimeapps.list: No such file or directory
This system has been updated multiple times (every day) and the ms-publisher association with .pub files has not come back. Note that this system has shared-mime-info installed and I am able to open public key files with a plain text editor, as I expect. In another user account on this system, I have my preferred association via an entry in ~/.config/mimeapps.list for that user.
$ xdg-mime query default text/plain
org.kde.kate.desktop
Back to the main question: How do I completely remove the association of .pub files with Okular and/or Libre Office Draw at the system level? Even if that's not an approved method, how do I do it?
