13

After installing a fresh Ubuntu (13.04) pem files (SSL certificates) are associated with "View file" (right click the file in Nautilus I see "Open with View file"), which nicely shows a clear text version of the certificate.

Now I wanted to edit the file and so chose "Open with another application" and selected gedit. It worked, but now I only see "Open with gedit" and cannot revert back to the "View file" program (or add it as another option). I also noticed many applications (for example Sublime, which is available in the Unity Lense) are missing in the dialog where I can choose which application to use for opening the file.

How can I get more (all that are "known" to unity, for example the lense) applications shown in the dialog where I can associate a file type with an application? Where can I find the "View file" application?

gucki
  • 4,582
  • 7
  • 44
  • 56
  • 5
    The "View file" for certificates is actually `/usr/bin/gcr-viewer` from [gcr packages](https://launchpad.net/ubuntu/+source/gcr), as stated in [@pim's comment here](https://askubuntu.com/q/977246/682592). – Dinei May 21 '19 at 18:53
  • I always forget its name. Thank you! Your comment should really have more upvotes. – hbobenicio Oct 21 '21 at 16:23

2 Answers2

11

Look at the file:

~/.local/share/applications/mimeapps.list

That will contain something like (this example is for a *.crt file):

[Added Associations]
application/pkix-cert=gvim.desktop;

Remove the offending line. You don't need to restart anything for the change to take effect.

GraduateOfAcmeU
  • 342
  • 3
  • 9
  • 1
    Thanks for this tip - worked great. Is there any way to get both apps to show so that you can double click the file to see the certificate as per default and also right click and do "open with other application" and view it in gedit? – ec2011 Oct 01 '14 at 09:41
  • 8
    Please review the file: ~/.config/mimeapps.list I had to remove the offending line from that file in order to solve the problem. Regards! –  Dec 09 '15 at 17:53
  • 1
    In Ubuntu 16.04 I haven't found anything in ~/.local/share/applications/mimeapps.list. I've had to remove it from ~/.config/mimeapps.list as user5660553 said. – Egl Jan 13 '17 at 11:32
  • this is lifesaving tip – xkeshav Apr 27 '17 at 09:55
0

For Ubuntu 22.10, the filetype associations are defined in a hierarchy of files called mimeapps.list:

$ locate mimeapps.list
~/.config/mimeapps.list
~/.local/share/applications/mimeapps.list
/snap/core/14447/usr/share/applications/mimeapps.list
/snap/core/14784/usr/share/applications/mimeapps.list
/snap/core18/2679/usr/share/applications/mimeapps.list
/snap/core18/2697/usr/share/applications/mimeapps.list
/snap/core20/1778/usr/share/applications/mimeapps.list
/snap/core20/1822/usr/share/applications/mimeapps.list
/snap/core22/509/usr/share/applications/mimeapps.list
/snap/core22/522/usr/share/applications/mimeapps.list
/usr/share/gdm/greeter/applications/mimeapps.list

/snap/core22/509/usr/share/applications/mimeapps.list contains the default association for *.crt files:

[Default Applications]
x-scheme-handler/http=xdg-open.desktop
x-scheme-handler/https=xdg-open.desktop
x-scheme-handler/mailto=xdg-open.desktop
x-scheme-handler/help=xdg-open.desktop

The above associates xdg-open with CRT files.

Clicking on a crt file displayed by an Ubuntu file manager like Nautilus causes xdg-open to open the file. You can also accomplish the same thing with the command line. For example, typing the following causes aw.crt to open:

$ xdg-open aw.crt

This is what xdg-open displays:

xdg-open display

As you can see, this is a combined certificate, containing not just one certificate, but an entire certificate chain. Clicking on any of the red > Details buttons causes more information to be displayed about one of the certificates in the chain.

The above is a portion of a blog post I wrote about generating wildcard SSL certificates on Ubuntu.

Mike Slinn
  • 7,705
  • 5
  • 51
  • 85