I would like to know if there is a command to open any file in Linux independently of their extension, just as if you were double-clicking it.

  • this is more associated with the mime types which are registered by your window manager desktop than to an application per se. In short, afaik there is no "double click" equivalent in command line as the double click is in fact a combination of a file picker + a list if registered mime types. – vfbsilva Jul 19 '15 at 0:01
  • 9
    xdg-open THE_FILE – PSkocik Jul 19 '15 at 0:06
  • 2
    Related: (if you don't have xdg-open) How does xdg-open do its work – Mark Plotnick Jul 19 '15 at 0:34

There are commands that are similar to the double-click: xdg-open is a fairly standard command that is shipped with many linux GUIs. On Debian distros, there is also see and open.

It would be good to point out that extensions are actually kind of arbitrary. There are so many esoteric extensions out there; no program, including the "double-click" can possibly know how to interpret every file out there.

And if you know the contents of file and the right program to run it, you should be able to execute/use the file regardless of its extension.

| improve this answer | |
  • 7
    xdg-open is much more standard than what you suggest. – Basile Starynkevitch Jul 19 '15 at 2:45
  • 2
    see and open are specific to Debian and derivatives. xdg-open is pretty much de facto standard nowadays (it's a Freedesktop standard). – Gilles 'SO- stop being evil' Jul 19 '15 at 21:25
gnome-open "filename"

works like a charm

| improve this answer | |

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.