Telnet into your server.
Now run:
screen -R -T vt100
Now do whatever you want, open a file with less, edit a file in vi, or
start a TUI, or whatever.
Now hit that big X in the upper corner. That is right, just toast your
telnet session, don’t exit out if it, just toast it.
Now log into your server again.
Now run:
screen -R -T vt100
You should be right back where you left from! Screen does not terminate
when your session drops, and it holds whatever programs, or sessions you
have open with it open too. Even ssh sessions to other servers.
I have the line “screen -R -T vt100″ as the last line in my .profile on
my server, and it was saving my tail almost daily while I was WFH. Every
time the VPN dropped me, I didn’t have to start over what was doing, or
wonder just what the patch job did when it got terminated half way
through.
(Technical NOTE: The -R tells screen to reconnect to any unconnected
screen session for the user, and if there isn’t one, start a new one, so
it either starts new, or connects. The -T gives screen the terminal
type. I found that programs like vi went nuts without this.)
Screen does lots of other cool things too. Here are some good sites
about it:
http://gentoo-wiki.com/TIP_Using_screen
http://www.hmug.org/man/1/screen.php
http://www.bangmoney.org/presentations/screen.html
Another cool feature is that two (or more) people can connect to the
SAME screen session. Great for training and collaborating. Since you can
do a telnet/ssh session from screen, there is no need for it to run on
your server, you can just start from your server and go from there. I
haven’t thoroughly tested that feature yet.
Here is my .screenrc file:
hardstatus on
hardstatus lastline
hardstatus string ‘Current:%n %t | %W | %C%A %D, %M %d, %Y’
vbell_msg “BEEP!â€
bell_msg ‘BEEP on %n’
vbell off
It gives me a nice status line at the bottom with a list of the open windows within screen and their names. I use some scripts to make sure my new windows get good names when I open them. I haven’t experiemented with the status line much, but it could probably be a lot fancier.
MultiUser Mode:
you have to go to the command mode (ctrl a and type multiuser on and
then command mode again and type acladd userid where userid is the
person you want to share with and you have to do that for every userid.