command-line – How to Open a File from Terminal

command linefiles

When we want to open an application or file from the terminal, we type, say,

okular file.dvi

This opens the application, but also shows the status of the application. We cannot close the terminal, because it kills the process. Unfortunately, if you're trying to, for example, create a LaTeX file, you will need one tab for the text editor, one for the dvi file, and so on. And if you're trying to open all windows from the terminal, you can forget it. I'm trying use the terminal as much as possible, and while I have Yakuake, it is still a bother having so many tabs and seeing which of those have an application I've killed and so on.

So, is there a way to open an application/file from the terminal so that the status doesn't show and immediately gives the prompt so that we can use it to open more applications?

Best Answer

xdg-open file.dvi

xdg-open will open any file with its default application. As a bonus, you can close the terminal without killing the application.

Since xdg-open is quite a long name, I put an alias for it in .bashrc:

alias open='xdg-open'