How to open any file through the command line

command linefile opening

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.

Best Answer

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.

Related Question