Super User is a question and answer site for computer enthusiasts and power users. 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

Using gnome terminal (Ubuntu 10.10), is there a way to execute the default application associated to a file type, only by typing its name, as it is possible with Windows ?

For example, say I create a mime type associated to every file with the pattern *.abc. Lets say I associate this file type to application 'my_app'.

If I have file '' in current folder, what I want is that when I enter only '' at the prompt, it executes 'my_app' feeding it with '' as first argument. (assuming of course 'my_app' is in the path)

I appreciate this behaviour in Windows, wondering if Linux/Gnome could do that too. Thanks

share|improve this question
You might have better luck on askubuntu – RobotHumans Dec 10 '10 at 16:21
Well, yes, actually, I didn't know askubuntu until now. Is there a way to "switch" this post to askubuntu ? – kebs Dec 10 '10 at 20:55
up vote 3 down vote accepted

You could use the binfmt_misc facility for something similar, but you're probably better off just passing it to xdg-open.

share|improve this answer
Very interesting, I'll investigate this tool, thank you. – kebs Dec 10 '10 at 20:55

On Linux with zsh ( you could achieve it in this way:

$ alias -s abc=my_app

And after it zsh will always execute my_app when you just enter

share|improve this answer

I don't know of any unix shell that allows you to execute any file in this way.

On Debian or Ubuntu, see myfile or edit myfile opens a file in the application that's associated to the file type through the mailcap mechanism. The command is from the mime-support package, which I think is installed by default on both Debian and Ubuntu (and anyway it's in many packages' dependencies, so it's probably installed already).

On many systems, you can use xdg-open myfile from the xdg-utils suite. This opens the file in the application that's associated to the file type through the Freedesktop mechanism. The Ubuntu package is xdg-utils, also probably installed already.

share|improve this answer
Yeah, xdg-open works fine, I was only trying to see if what was possible on Windows could be transposed to Linux ;-) I struggled a bit with binfmt_misc, but couldn't get it to work in a seimple way, i.e.: echo ':txt_file:E:*.txt:::/usr/bin/gedit::' > /proc/sys/fs/binfmt_misc/register but this doesn't work on my machine... I guess it wasn't designed to do such things in the beginning. – kebs Dec 14 '10 at 13:46
And by the way, do you guys know if there is any difference between "see" and "xdg-open" ? They both seem to use the system's mime database... – kebs Dec 14 '10 at 13:51
@kebs: see uses exactly the system's MIME database (including ~/.mailcap. I think xdg-open uses a completely different FreeDesktop-specified database, but Debian and Ubuntu packages tend to populate both these databases. – Gilles Dec 14 '10 at 22:15

You could use gnome-open for that. Works pretty well for me.

share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .