sudo apt-get install screen
screen
You will now have a new console prompt. Anything you do in here will continue to run after your SSH session closes. When you reconnect with SSH later:
screen -dr
You are now reconnected to your screen session, which continued running while you were gone.
If you create more than one screen session, you'll get a list of all the screen sessions currently running when you do screen -dr
as above - just do screen -dr pid
(where pid is the pid number of the session you want to reconnect to) in order to choose one.
Typing exit
while in a screen session will close the screen session for good, just as it would in a normal SSH or other console session.
PuTTY
– GeekFactory Nov 22 '12 at 15:12nohup *command* &
, complete with trailing ampersand, for it to work. Also: screen is almost always a better solution for this kind of thing. Details for usage in an answer below, in case the manpage is a bit too chewy to get you started (I avoided screen for far too long for exactly that reason; I wish somebody had explained it to me simply!) – Jim Salter Nov 22 '12 at 17:18