In a mac cli, I can type open file.jpg and the mac will automatically figure out the correct application and open it for me.

In Windows, the start command does the same thing, but also will open up explorer to working directory if given no parameters.

Is there a way to do that in linux? (maybe only certain distros?)

migrated from stackoverflow.com Feb 4 '10 at 19:21

This question came from our site for professional and enthusiast programmers.


If XdgUtils is installed files can be opened via

xdg-open file

Otherwise there might be something provided by the desktop environment, e.g. for gnome

gnome-open file

Try xdg-open. Should be supported by most distros and desktops.


It seems that you can append an ampersand to your line:

Windows :

start "Title" /MIN <application>

Linux :

<application> &

As a result, you'll see the process ID of the application and in the terminal window where you're located, you'll see the output of the application.

  • This suggestion will start a program running in the background. I was interested in taking any file (not just executables) and having the OS automatically find the default program associated with that file, and then have that program start it for me. For example, in Windows I can type start file.jpg and it will find the image viewer program and open the file for me. – Alexander Bird May 4 '16 at 20:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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