Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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

When I run a process on a remote Linux machine, the process stops if the connection is terminated for some cause. This behavior is reasonable, because otherwise irrelevant processes would keep running forever.

However, is there a way to prevent this from happening? Namely, I want to open a remote shell, run a process and direct its output to a log file, and log out - but keep the process running.



share|improve this question
up vote 2 down vote accepted

Well first option can be to spawn you program as another process with the & operator like

$ myprogram > file.log &

Or you can have a look at the screen command where you can store and retrieve your terminal sessions.

share|improve this answer

You can either use a screen session or push the process to background disconnecting it from the shell.

also check,

shopt -u huponexit

share|improve this answer
That's great - thanks! Perhaps nohup will work, too. – Adam Matan Aug 26 '09 at 9:06

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.