Ubuntu – How to open a GUI application and ‘disconnect’ it

command linegui

I can run Sublime, for example, in the background by typing

sublime-text &

The & puts it into the background so that I can continue to run commands in my terminal. Alternatively, I can run

sublime-text

Which locks up my terminal. If I then press Ctrl+Z it "suspends" the application which essentially freezes it (it will eventually turn gray). Typing bg moves it into the background and unlocks the terminal.

In any case, if I exit the terminal or type fg and then Ctrl+C, the application will close.

How do I "disconnect" the GUI application from the terminal so that it will not close should I close the terminal or press Ctrl+C? In other words, I would like to use the terminal as a launcher, which is particularly convenient when I want to open a specific file: e.g., sublime-text /path/to/my/file <super-secret-character-that-disconnects-the-app-not-just-puts-it-in-the-bg>.

Best Answer

You can use disown command to detach background processes from the terminal.

If you have only one running background job, you can simply use

disown

and the owner of this background process will no longer be the terminal, so it will keep running even after the terminal is closed.

Related Question