Changing Default File Type In CentOS 6

Home » CentOS » Changing Default File Type In CentOS 6
CentOS 12 Comments

It turns out my markdown files – extension .md – are of the “Genesis ROM” file type in CentOS 6. Googling did not turn up any obvious places to change this in Gnome – neither in my local directory or in /etc/gnome.

Where would I be able to change this default file type for files with the extension .md? I have already changed the default application to geany (with the markdown extension.)

Thank you.

12 thoughts on - Changing Default File Type In CentOS 6

  • Do you mean that you want to change the default program that the file will open with when you click on it?

    Right-click on a file of that type. Properties. Open with

    Set that option as needed.

  • have a look at these:
    /etc/mime.types (file)
    /usr/share/mime/ (dirs)
    /usr/share/mimelnk/ (dirs)
    /usr/share/mime-info (dir)

    grep for ‘\.md’ and/or for ‘Genesis ROM’ in there.

    Just adding your own line to /etc/mime.types may look nice, but is possibly not what you want, more likely a new entry in a file or directory under ~/.local/share/mime/

    Have a nice weekend
    – Yamaban.

  • I’m missing something here. Do you mean that you want to change icon that shows up in a Nautilus window for a particular filetype?

  • I think the OP is talking about the file type that Nautilus reports when you right-click on a file and bring up the ‘Properties’ dialog.

    In my case (also CentOS 6) Naulitus reports ‘Genesis ROM’ for files with the .md extension. The file command, on the other hand, reports ‘ASCII
    English text’.

    The file responsible for the behaviour of Nautilus is
    /usr/share/mime/application/x-genesis-rom.xml, which appears to have been generated by update-mime-database.

  • Correct. I looked at that file and it says “created automatically by update-mime-database. do not edit” which begs the question: how can I
    “correct this?”

  • Files in ~/.local/share/mime also seem to have been automatically generated by update-mime-database and should not be edited. Should I
    still create a new file for the “.md” extension and add it to this directory?

  • IMHO something is fishy in your install here.

    /usr/share/mime/application/x-genesis-rom.xml is generated from:
    /usr/share/mime/packages/freedesktop.org.xml by the update-mime-database tool

    for “Genesis ROM” the glob pattern=”*.gen” is set and as well as the “magic” patterns:
    match value=”SEGA” type=”string” offset=”256″
    match value=”EAGN” type=”string” offset=”640″
    match value=”EAMG” type=”string” offset=”640″

    Just how are your “text/markdown”, glob pattern=”*.md” files
    “discovered” as “Genesis ROM” ??

    Eitherway,

    to disable the future creation of the file:
    /usr/share/mime/application/x-genesis-rom.xml you have to comment out the relevant section in:
    /usr/share/mime/packages/freedesktop.org.xml

    then remove /usr/share/mime/application/x-genesis-rom.xml and run the update-mime-database as root.

    Be aware, future updates of the file:
    /usr/share/mime/packages/freedesktop.org.xml will re-enable the application/x-genesis-rom mime-type.

    Have a nice sunday
    – Yamaban.

  • Huh? The “orignal” text/x-markdown file should already exist globally:

    /usr/share/mime/text/x-markdown.xml

    also generated from tis file:
    /usr/share/mime/packages/freedesktop.org.xml

    but, feel free to do so:
    [code]
    mkdir -p ~/.local/share/mime/text cp -t ~/.local/share/mime/text /usr/share/mime/text/x-markdown.xml
    [/code]

    or, create is yourself, short version content follows
    (view mail as source or plain text if not shown)
    [code]
    < ?xml version="1.0" encoding="utf-8"?>

    Markdown document





    [/code]

  • I commented out the Genesis ROM section in /usr/share/mime/packages and then ran

    “update-mime-database /usr/share/mime”

    whereupon the .md files now show as “plain text files” in a directory window.

    In addition to the “.gen” glob pattern, the glob pattern “.md” was also in the Genesis section.

    I wonder if the fact that I had kdesdk installed a short while trying to use kate as a markdown editor? I eventually removed it after it seemed to lock up Firefox… Since then, no more lockups.

  • No, I don’t have x-markdown.xml, nor is markdown mentioned in freedesktop.org.xml.

    I did follow your suggestion, first created the ~/.local/share/mime/text directory and then copied the code you listed into the file x-markdown.xml into that same directory.

    Unfortunately the “.md” files still show as “plain text document” – is there something else I should do?

    In the process I also lost the file type for pdf-documents which now show as file type “unknown”…

  • Found the problem with the disappearing file type for pdf-documents: I had been too quick editing the freedesktop org.XML file which is now corrected.

    I am still unable to have .md files displayed as markdown files – display as “text/plain type” – and in addition I seem to have lost my icons… Tried to back out but the icons are still absent. Clearly an edit I made caused this.

LEAVE A COMMENT