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?

  • in any case, for most cases a "Run program..."-style launcher will do.
    – deprecated
    May 13, 2012 at 17:16

1 Answer 1


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 `|'"
  • cool! apparently one can't do it in one line right? will consider switching to zsh.
    – deprecated
    May 13, 2012 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, 2012 at 17:35
  • @vemv try nohup. Example - nohup firefox May 13, 2012 at 21:22

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