Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

Possible Duplicate:
How can I close a terminal without killing the command running in it?

If I open a terminal emulator, type firefox & and then close the terminal, the process it launched -Firefox- gets killed as it was its child.

How can I prevent this behavior?

share|improve this question
    
in any case, for most cases a "Run program..."-style launcher will do. –  vemv May 13 '12 at 17:16
add comment

marked as duplicate by Mikel, Renan, Gilles, jasonwryan, jw013 Nov 7 '12 at 14:21

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

1 Answer

up vote 6 down vote accepted

Use the disown command. In zsh you can also use &| to background and disown in a single operation.

$ firefox &
[1] 74773
$ disown %1 # or "disown %firefox"
$ firefox &| # zsh only; bash will report "syntax error near unexpected token `|'"
share|improve this answer
    
cool! apparently one can't do it in one line right? will consider switching to zsh. –  vemv May 13 '12 at 17:31
    
I couldn't find one, sadly. Possibly someone more expert in bash knows a trick, other than a shell function that manipulates job control to do it. –  geekosaur May 13 '12 at 17:35
    
@vemv try nohup. Example - nohup firefox –  Ulrich Dangel May 13 '12 at 21:22
    
cute, thank you. –  vemv May 13 '12 at 21:32
add comment

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