Ubuntu - Markdown files, MIME type and .md association

One of my biggest problems with Markdown files on my Ubuntu machine was the MIME type and the corresponding file type association.

The main issue was, that it wasn't possible to open .md files in the file browser of gedit.


The default MIME type of .md files are "Genesis ROM". I don't know anything about this file type, but also never care for it.

So, let's not waste the time and fix this issue.

We want to have a more useful association. I heavily use the file suffix .md for my markdown files, and I want to see them also in my gedit file browser, too! Now!

After some googling, I found a solution and will present it here.

Step 1

Eliminate the disturbing Genesis ROM MIME type.

File: /usr/share/mime/packages/freedesktop.org.xml

Search for:

Delete this line (sudo needed).

Step 2

Create a new MIME type definition for Markdown files.

Let's name the file /usr/share/mime/packages/markdown.xml

Insert (sudo needed):

        Markdown Markup

(If markdown files have further extensions ==> add them.)

The MIME type "text/x-web-markdown" was found also by googling around. We want to have an almost valid definition, want not?

Step 3


sudo update-mime-database /usr/share/mime

Have fun!

Now gedit (and every other application) should be happy now.

For me it works; my gedit file browser shows the .md files in the pane and I haven't to switch to an external file browser for opening.

Happy markdowning!


It might be possible, that the freedesktop.org.xml will be overwritten while an update of shared-mime-info package. If so, you have to repeat step 2 and 3, because the regeneration will override our own definition.

Maybe --if it depends on alphabetical order of the xml files-- rename markdown.xml to 000-markdown.xml or something else which comes before letter F. ;o)

Kudos to this thread.