Thursday, February 19, 2009


I work remotely a lot, and mostly using ssh, since it's more secure than telnet. There's a time when the process takes very long time, and I don't want to always be connected the whole time.
The problem is, when I put the process in the background (using ctrl-z and bg, or using "&" when executing), when I exited the remote shell, all processes belong to that remote shell will be terminated.

One way to resolve this issue is using "nohup". This is very useful when the process does not require any interaction. Still I'm not satisfied with "nohup."

Then I came across this very neat tool, "screen." Very elegant way to do things remotely.

Do the following:

$ screen

it will give you the session, and start to do any activity. So, when I want to leave the remote shell. Press --> ctrl-a, d. That command will detach the screen session, and it's save to exit the remote shell.

To resume that particular session. Login again to the remote computer, then look at the detached session, by:
$ screen -ls
$ screen -r <session_id>

No comments:

Post a Comment