19 February 2007

Detachable sessions with screen

With a detachable session you can start programs on a remote machine (via ssh for example), close the connection to the remote machine and still have your remote programs running and reachable.
The 'screen' application provides this functionality. You can start a teminal session via screen, drop the connection and reconnect to the session again, at a later point in time. This is usfull when doing remote administration over an un reliable connection.

Installing screen on FreeBSD isn't hard:
First make sure you'v installed and updated the entire ports tree.
# cd /usr/ports/misc/screen
# make
# make install


Using screen isn't hard too:
Starting a session:
screen -S <name of this session>

Detach from within a session, but keep the session running:
[ctrl]-a d

Reattach to a session:
screen -r <name of the session> (if there's only one session running, the name is optional)

No comments: