Opening a file from terminal

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?


Solution 1:

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'

Solution 2:

okular file.dvi &

just append an & to make your command running as separate process.

Solution 3:

okular file.dvi &> /dev/null & would be a bit better. This way, the program does not write to the terminal.

If you use just okular file.dvi & the program will still report things on the terminal, often in the middle of your work