Tuesday, May 7, 2024
4
rated 0 times [  4] [ 0]  / answers: 1 / hits: 3315  / 3 Years ago, mon, october 18, 2021, 12:51:12

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>.


More From » command-line

 Answers
3

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.


[#26346] Wednesday, October 20, 2021, 3 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
homerurhyth

Total Points: 338
Total Questions: 113
Total Answers: 105

Location: Moldova
Member since Sat, Aug 6, 2022
2 Years ago
;