When I click on a PDF link, my Firefox 31 (and older versions as well) always tries to open it with gedit, even though in Nautilus and xdg-open it gets correctly opened in Evince. In Edit->Preferences->Applications the PDF content type action is set to "Save File".

I use GNOME Shell 3.12.2 on Arch Linux 64 Bit.

2 Answers 2


I've found some pointers to this.

First, check what program the system uses for a PDF file.

Then, there is the horrible mimetypes.rdf file which stores Firefox preferences for opening applications. It is somewhere in your /home/you/.mozilla profile directory.

Then, when something is 'unknown' it will be opened by some kind of guessing algorithm.

To change this, I heard you can do this:

sed 's#.*octet-stream.*#application/octet-stream=xdg-open#' ~/.local/share/applications/mimeapps.list -i

Just tested this myself and found xdg-open will correctly guess the file type.

You can also edit the mimeapps.list by hand. Just set it to 'xdg-open' (no need to append .desktop unless you want it to open via a .desktop link). The application/octet-stream is often used by sites that do not correctly set their mimetype when sending you a file.

  • My .mozilla indeed had a line application/octet-stream=gedit.desktop;, thanks! Sep 23, 2014 at 13:03
  • 4
    I just removed "application/octet-stream=org.gnome.gedit.desktop;" from ~/.config/mimeapps.list and everything works OK now.
    – user31389
    Mar 4, 2015 at 21:06
  • 3
    ~/.config/mimeapps.list was the culprit for me too
    – Flamefire
    Apr 19, 2018 at 10:49

To set files applications with standard xdg-open (man xdg-open):

xdg-open /path/to/the_file.EXT

I bet the sed command that Iphigeneia recalled should replace mimeapps.list associations entries with automatic xdg-open? Doesn't change any mimeapps.list lines here; Not an expert with sed to tell why, though.

Some more pointers in https://askubuntu.com/questions/185139/why-does-firefox-try-to-use-gedit-to-open-deb-files

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.