Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Possible Duplicate:
How do I prevent a script from terminating when the shell exits?

I use gnome-terminal, and I run emacs under the terminal in the background by executing emacs &, but after I close the terminal, emacs is also closed. How can I avoid this behavior? I know that emacs is a child process of the shell.

share|improve this question

marked as duplicate by andcoz, manatwork, Michael Mrozek Jun 6 '12 at 15:45

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.

unix.stackexchange.com/questions/479/… and many other similar questions you can find here. – rush Jun 6 '12 at 14:29

Check out GNU Screen. You can run something in the screen, then detach and disconnect and the script/program continues to run.

Link: http://www.gnu.org/software/screen/

Screen can be found in most distros. Ubuntu has a forked "Super" version of it available as well.

share|improve this answer

You can start emacs using the nohup command. nohup will run a command immune to hangups, with output to a non-tty

nohup emacs &

This will prevent the emacs process from terminating when the shell closes and the controlling terminal is destroyed.

You can get more information about nohup from info coreutils 'nohup invocation'

This is a nice discussion about nohup, disown, and &.

share|improve this answer

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