Server Fault is a question and answer site for system and network administrators. 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

I am running linux and I am running a script/program in the background using

cmd &

This works fine on Solaris, but on my Linux box (2.6.9-55/ Red Hat), the background process stops when the originating terminal window is closed/loses connection. What do I need to change this, so that this works as it works on Solaris?

share|improve this question
up vote 6 down vote accepted

You have to use the disown command (it may be specific to bash, not sure about it).


cmd &

should do the trick.

If you want to reattach later the job to the terminal, use:

disown -h

Alternatively, you can use screen. Use it this way:


Then, to go back to the terminal, hit ctrl+a, then d.

To come back to the screen, type in any terminal:

screen -r
share|improve this answer
I think you're wrong about reattachment with disown. Can you prove this performance? – Warner Mar 4 '10 at 14:44

if you run nohup cmd &, so the program will ignore the SIGHUP it gets when the termial closes.

share|improve this answer
This is definitely the solution that works for me. All disown seems to do is remove the process from the jobs list. – Nathan Sep 16 '10 at 17:14

Your Answer


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.