Very Secure

keeping a program running on a remote computer

When you ssh into a box, often times you want to run a program that will keep running even when you close your terminal window. There are basically two options i know of that do this:

1. nohup
2. screen

I recommend using screen. To run a program with screen simply type:

$screen -L ./my-program

Then you will be put into a new shell, the "screen" that will persist even when you close your terminal window. Then do Ctrl-a D to detach from the screen and return your normal terminal. Now you can close your terminal window and ssh back into your box. To view all your programs running through screen type

$screen -list

Then to go back into the screen that is running your program run

$screen -r

I don't know how to use screen beyond this. But these few simple commands are very powerful.

Leave a Reply