Opening a file using the default viewer on Linux

I work in an OS-independent file manager (mainly Windows and Linux), and I am wondering if there is a way to open a Linux file in my default viewer. For example, open an html file with Firefox, .avi with vlc, etc. On Windows, there is a ShellExecute () function that does this, but I understand that on Linux this is not so simple, and every desktop environment has a specific path. I would appreciate any help with this.

+5
source share
4 answers

You can use xdg-open(1). It works on all freedesktop compatible desktop computers.

+10
source

, Linux. Gnome, , MIME, , , .

+1

mime- /etc/mailcap $HOME/.mailcap, (, , ). - run-mailcap. . man run-mailcap (1) mailcap (5).

+1

. .

xdg-open , "gnome-open" GNOME "kfmclient" KDE.

0

All Articles