2

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?

1

2 Answers 2

6

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.

5

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:

disown %1

If you have more than one backgrounded process, type:

jobs

to get a list.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .