How do I open a file with a specific program Ubuntu?

Open file from terminal in specific application

Table of Contents

I use xdg-open a lot in the terminal; this opens a file in the default application. However, sometimes I'd like to open a file in a different (non-default) application. Is there a way to achieve this from the terminal?

(Obviously, some applications can take a file as an argument, e.g. vlc /path/to/movie.mp3, but I'm looking for a more generic way that works in all situations, similar to xdg-open.)

An advantage of an xdg-open-like command is that the terminal window can be closed after opening the file/application. However, if I use (e.g.) vlc /path/to/movie.mp3 &, then I'll need to keep the terminal window open.

Source: Ask Ubuntu

Related Articles