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

How do I connect to ssh debian and running a program and let it continue to run after you finish my connection through ssh.

share|improve this question
up vote 5 down vote accepted

You can simply nohup the program you are starting and put it in the background akin to:

nohup someShellScript.sh > nohup.out 2>&1 &

EDIT as per Thor's suggestion

From non-interactive session:

ssh <hostname> "nohup someShellScript.sh > nohup.out 2>&1 &"
share|improve this answer
Remember to quote the command, i.e. if the above is cmd=... then use ssh remote "$cmd". – Thor Sep 13 '12 at 13:29

There are at least two way to do that

1) nohup command as already mentioned. Wikipedia has an article about nohup

2) There are two popular terminal multiplexers screen and tmux They enable a number of terminals, each running a separate program. There are a lot of tutorials and how-to about both tools on the Internet, just google

share|improve this answer

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.