Tuesday, August 05, 2008

*nix Screen

Screen is a neat way to keep your processes running when you need to disconnect from the machine or have a dodgy connection which gets reset (my case!).

You run screen on a *nix machine that is always on and it keeps your processes running even if the connection dies or if you want to disconnect.

My setup:

~/.screenrc

startup_message off

# hardstatusline
hardstatus on
hardstatus alwayslastline
#hardstatus string '%{= kG}%-Lw%{= kW}%50> %n%f* %t%{= kG}%+Lw%< %{= kG}%-=%c:%s%{-}'
hardstatus string '%{= kG}%-Lw%{= kW}%50> %n%f* %t%{= kG}%+Lw%<'

screen -t ubuntu3 0
screen -t ubuntu3 1
screen -t ubuntu2 ssh ubuntu2

Usage:

to start:
screen

to reconnect to an existing screen session
screen -x

to switch screens (n is the screen number)
Ctrl+a n

to close a screen
Ctrl+d

Note: if the machine hosting screen reboots then the screen session is lost

More info here:
http://www.askbjoernhansen.com/2006/02/07/happy_unix_screen.html
http://www.rackaid.com/resources/linux-tutorials/general-tutorials/using-screen/
http://nigel.mcnie.name/blog/how-i-use-screen

On Mac OS X, probably need to make an adjustment so your backspace key works:
http://www.pyrosoft.co.uk/blog/2008/04/28/fixing-the-backspace-key-with-os-x-and-linux-screen/

0 Comments:

Post a Comment

<< Home