Linux equivalent of the Mac OS X “open” command [c

2019-01-12 13:38发布

I've found the "open" command in Mac OS X very handy in the command line. From "man open":

The open command opens a file (or a directory or URL), just as if you had double-clicked the file's icon. If no application name is specified, the default application as determined via LaunchServices is used to open the specified files.

That is, if I want to open a PDF file with the default PDF viewer (happens to be Preview), I only need to do:

open my.pdf

In Linux, however, to open a PDF file from the command line, I had to dig around to find the default PDF viewer is, for instance, "evince" (who'd have guessed??), and then

evince my.pdf

So, is there a simple equivalent of the 'open' command in the Linux command line?

Thanks!

7条回答
戒情不戒烟
2楼-- · 2019-01-12 14:27

If you have your mimes setup correctly, you can use mimeopen. Check out its man page, since it has some useful options.

查看更多
登录 后发表回答