2

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.

  • 3
    http://unix.stackexchange.com/questions/479/keep-ssh-sessions-running-after-disconnection and many other similar questions you can find here. – rush Jun 06 '12 at 14:29

2 Answers2

3

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.

Tim
  • 6,141
0

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 &.

George M
  • 13,959