Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

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?

share|improve this question
    
This discussion about opening processes from the terminal might help as well: askubuntu.com/questions/167147/opening-a-file-from-terminal/… –  user76204 Aug 9 '12 at 23:31
add comment

2 Answers 2

up vote 7 down vote accepted

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.

share|improve this answer
add comment

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.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.