automatically disown application when running it from a terminal
4
votes
3
answers
5674
views
How do you automatically disown an application after you have started it from a terminal?
For example: if you start a terminal and run
firefox
the application will start, but when you then close the terminal firefox will close as well. To avoid unintentionally closing applications that have been started from a terminal, one can first put them in the background with the ampersant: firefox &
which also restores the ability to use that terminal's prompt.
Next, you can disown the application from that same terminal using the process ID (PID) of the application, see this example below:
$ firefox &
$ ps | grep firefox
14917 pts/6 00:00:00 firefox
$ disown 14917
The application now runs independently from the terminal you are using, and closing the terminal will no longer terminate the application.
**But how can you do this automatically each time you start an application?**
Asked by PDiracDelta
(163 rep)
May 21, 2016, 07:56 PM
Last activity: Mar 4, 2024, 01:47 AM
Last activity: Mar 4, 2024, 01:47 AM