I use firefox &
as command in terminal. This must dissociate firefox from terminal. Still when I close terminal, firefox exits. Any ideas, why this happens? How can I overcome this situation?
I use firefox &
as command in terminal. This must dissociate firefox from terminal. Still when I close terminal, firefox exits. Any ideas, why this happens? How can I overcome this situation?
You can exit the terminal by pressing Ctrl+D; this will break the parent-child chain, so that the terminal is no longer the parent.
Using the ampersand only places the process in the background; it doesn't disassociate the parent from the child, so when the parent process exits, so do its children.
As has previously been stated, the additional
&
only puts the process in the background (i.e. you get a new prompt) and can type in a fresh command.Killing the parent process, by closing the terminal, sends a signal to all child processes to end.
Depending on the shell you are using you can de-couple the processes by using nohup or disown. The later is probably what you want, as the former is required in invocation. You need to specify the job number proceeded by a
%
, most likely this will be 1. So type:If you have more than one backgrounded process, type:
to get a list.