如何找出哪个程序可以打开给定的文件?

sch*_*obe 6 command-line shell files file-opening

假设我有一个文件thesis.pdfpicture.jpg

是否有一个命令返回一个程序来打开这个文件?

我知道 command file,但它只返回正确的文件类型(我知道这不是由其在 Linux 中的扩展名指定的)而不是程序。

我期待这样的事情:

$ program 'picture.jpg' 
gimp, gwenview, eog
Run Code Online (Sandbox Code Playgroud)

SHW*_*SHW 9

mimeopen -a 'picture.jpg'

这就是你需要的

它会给你这样的输出

Please choose an application

    1) Shotwell Viewer  (shotwell-viewer)
    2) Firefox Web Browser  (firefox)
    3) Image Viewer  (eog)
Run Code Online (Sandbox Code Playgroud)

  • 喜欢 Linux - 总是有一些新的伟大命令可以发现...... :-)) (2认同)