How to open any file through the command line?
58,998
Solution 1
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.
Solution 2
gnome-open "filename"
works like a charm
Related videos on Youtube
Author by
Carl Rojas
Updated on September 18, 2022Comments
-
Carl Rojas almost 2 years
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.
-
Admin almost 9 yearsthis 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.
-
Admin almost 9 years
xdg-open THE_FILE
-
Admin almost 9 yearsRelated: (if you don't have xdg-open) How does xdg-open do its work
-
-
Basile Starynkevitch almost 9 years
xdg-open
is much more standard than what you suggest. -
Gilles 'SO- stop being evil' almost 9 years
see
andopen
are specific to Debian and derivatives.xdg-open
is pretty much de facto standard nowadays (it's a Freedesktop standard).