Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Let's say I have a file thesis.pdf or picture.jpg

Is there a command which returns a program to open this file with?

I am aware of the command file, but it just returns the correct type of the file (I know that this is not specified by its extension in Linux) and not a program.

I am expecting something like:

$ program 'picture.jpg' 
gimp, gwenview, eog
share|improve this question
up vote 9 down vote accepted

mimeopen -a 'picture.jpg'

This is what you need

It will give you output like this

Please choose an application

    1) Shotwell Viewer  (shotwell-viewer)
    2) Firefox Web Browser  (firefox)
    3) Image Viewer  (eog)
share|improve this answer
Awesome! Exactly what I was looking for! – schrobe Jul 17 '14 at 8:57
Love Linux - always some new great command to discover... :-)) – Baard Kopperud Jul 17 '14 at 13:26

Use: mimeopen -a 0001.jpg

-a will first Ask you to choose, not run it.

Please choose an application

1) Wine Internet Explorer  (wine-extension-jfif)
2) Wine Internet Explorer  (wine-extension-jpe)
3) Firefox Web Browser  (firefox)
4) Luminance HDR  (luminance-hdr)
5) ImageMagick (display)  (display.im6)
6) Image Viewer  (eog)
7) Shutter  (shutter)
8) Phatch Image Inspector  (phatch-inspector)
9) Phatch PHoto bATCH Processor  (phatch)
10) Shotwell Viewer  (shotwell-viewer)
11) GIMP Image Editor  (gimp)

use application #

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.