Good answer is already posted by @Steven D, yet I think this might clarify it a bit more.
The reason that the process is killed on termination of the terminal is that the process you start is a child process of the terminal. Once you close the terminal, this will kill these child processes as well. You can see the process tree with pstree
, for example when running kate &
in Konsole:
init-+
├─konsole���┬─bash─┬─kate───2*[{kate}]
│ │ └─pstree
│ └─2*[{konsole}]
To make the kate
process detached from konsole
when you terminate konsole
, use nohup
with the command, like this:
nohup kate &
After closing konsole
, pstree
will look like this:
init-+
|-kate---2*[{kate}]
and kate
will survive. :)
An alternative is using screen
/tmux
/byobu
, which will keep the shell running, independent of the terminal.
yourExecutable &
and the outputs keep coming on the screen andCtrl+C
does not seem to stop anything, just blindly typedisown;
and pressEnter
even if the screen is scrolling with outputs and you can't see what you're typing. The process will get disowned and you'll be able to close the terminal without the process dying.