Super User is a question and answer site for computer enthusiasts and power users. 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 Duplicates:
Keep a program running after closing a console, after the program has started
How can I use ssh to run a command on a remote Unix machine and exit before the command completes?


I want to run program from my notebook by SSH-connection to remote server. The problem is I am going home with my notebook :)

How to keep program running?

share|improve this question

migrated from Apr 25 '10 at 14:28

This question came from our site for professional and enthusiast programmers.

marked as duplicate by Arjan, quack quixote Apr 25 '10 at 15:25

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.

up vote 21 down vote accepted

'screen' is most likely what you want. It allows you to disconnect and reconnect at will. After you SSH into the server, run screen before starting your program. Ctrl-a, Ctrl-d will disconnect you (the program continues regardless). On your return, 'screen -r' will reconnect you as if you'd never been away.

Think of it as VNC or RDP for text terminals. Search for 'using screen' for many tutorials.

Edited to add: These days I would recommend tmux instead, especially if used in conjunction with the script tmx. The ability to split panes (vertically and horizontally) and resize them is a huge boon over screen.

share|improve this answer
Incidentally, screen will keep running if your connection times out or anything like that while you're still attached to it. Some useful commands: ctrl + a, ctrl + d = detach from screen, screen -r = re-attach to a screen, screen -x = attach to a screen in shared mode (can be used for teaching etc, two users can share the same screen), ctrl + a, esc = enter scroll mode (hit q to exit again). NOTE: If you start a screen by typing "screen program" it will immediately launch the program in screen, but if it exits you'll lose the buffer. Typing just "screen" will give you a persistent terminal. – d11wtq Apr 25 '10 at 13:23
Chris, also tnx for usefull answer. – Max Apr 25 '10 at 13:24
+1: I love screen! – Josh Apr 25 '10 at 14:42

nohup is a command that will run another command, and make it immune to the "hangup" signal.

You run it as simply as:

nohup command

but you will also need to redirect stdin, stdout and stderr. See the man page for more info.

You'll also probably want to put it in the background.

You will also need to know the kill command to eventually kill it.

share|improve this answer
Yes, tnx a lot! so easy )) – Max Apr 25 '10 at 13:15
This is the one that I use. Very very easy. Use tee to redirect stdin, stdout, and stderr. – mechko Apr 25 '10 at 16:58

Not the answer you're looking for? Browse other questions tagged .