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.
Asked
Active
Viewed 6.0k times
14
Gilles 'SO- stop being evil'
- 807,993
- 194
- 1,674
- 2,175
Carl Rojas
- 1,049
- 4
- 14
- 27
-
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 00:01
-
10`xdg-open THE_FILE` – Petr Skocik Jul 19 '15 at 00:06
-
2Related: (if you don't have xdg-open) [How does xdg-open do its work](http://unix.stackexchange.com/questions/144047/how-does-xdg-open-do-its-work) – Mark Plotnick Jul 19 '15 at 00:34
2 Answers
9
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.
robert
- 556
- 1
- 3
- 9
-
7
-
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