Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a shell script "the_script" that I would like to register as the default application for the files with the extension ".ext". For this purpose, I have written an xml file to register the mime type, and a .desktop file to associate the application with the mime type. The script has the executable bit for the user and is available in the user's path.

The xml file, named "the_script.xml" is as follows:

<?xml version="1.0" encoding="UTF-8"?>
<mime-info xmlns="">
    <mime-type type="application/x-the-script">
        <comment>A file for the script</comment>
        <glob pattern="*.ext"/>

Then I ran xdg-mime install --novendor the_script.xml.

The .desktop file, named "the_script.desktop" is as follows:

[Desktop Entry]


Name=The script that manages .ext files

Comment=Interpreter for .ext files

Exec=the_script %f

And I ran xdg-desktop-menu install --novendor the_script.desktop to register the file.

Once that both files are registered, the .ext files do not open with the text editor any more but Gnome tells me that there is no installed application for the files "A file for the script".

I have successfully registered other file formats with other applications. The other applications were compiled programs while the_script is a shell script. That is the only difference I can see. How can I register my script with the .ext files?

share|improve this question
Do you need that for application deployment? In that case my answer wouldn't help, of course. – htorque May 9 '12 at 10:08
@htorque There is no deployment needed yet; describing your workaround to the users is an acceptable solution for the moment. Nevertheless I would prefer a solution that would allow deployment (changes in the .desktop file? changing the interpreter in the script? (currently/bin/sh)) – julien May 9 '12 at 11:55

This seems to work fine from a terminal if you do xdg-open foo.ext, however it doesn't seem to work in Nautilus unless you define your script as default for opening the *.ext file:

  • Select such a file,
  • Right-click,
  • Choose Properties,
  • Select the Open With tab,
  • Click on Show other applications,
  • Select your script (should be The script that manages .ext files),
  • Click Set as default, and finally press
  • Close.

After I did that, the script started from Nautilus.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.