From Netsoc Wiki
Jump to: navigation, search


What is Screen

Screen allows you to run programs in the background. It's kinda like having a 2nd ( or 3rd, 4th, 5th...etc.) terminal window open but all within the same actual window. It is technically a terminal multiplexer.

Why Screen

Screen is particulary useful for IRC clients. It allows you to run your irc client in its own "screen" and will continue to run even if you disconnect from the unix machine. This means:

  • You have a log of all the conversation you missed (YAY)
  • If your connection goes wonky you can just reattach and continue from where you left off (w00t)
  • You can access your IRC session from anywhere you can SSH from (!!!)
  • You don't have to perform all the commands you usually perform when running Chat for the first time

Screen is not just for IRC however (although some seem to think so), and can be used (as previously mentioned) to operate multiple terminal windows from just one ssh/PuTTY session. To open another window in screen, hit crtl+A and then c. Your screen session will switch to your new terminal. To switch to your previous terminal, hit ctrl+a twice. Terminals are stored in sequence, so your first terminal is "0", and so on. To switch between more than two terminals, hit ctrl+a and then the terminal's number. Alternatively, you can use ctrl+n (next) or ctrl+p (previous) to cycle through terminals.

Using Screen with Chat

This section focuses on using Screen in conjuction with the Chat script. Firstly connect to whatever netsoc server you want), Next, enter "screen chat" into your terminal.

screen chat

Now you can connect to servers and join channels as usual. See Chat for more information. When you've finished ircing your time away, do not exit chat but rather press ctrl-a d (control key and a at same time, then d key). This will detach the screen. You may exit the ssh session as usual. Next time you want to use irc, connect to the same server as usual and enter "screen -dr", like so

screen -dr

This will reattach the screen session and will put you back in Chat as if you never left.


(start) screen chat
(detach) ctrl-a d
(resume) screen -dr

Frozen Screen

After using screen for a while you'll find that a particular window just freezes. One possible cause of this is that you pressed Crtl-S by accident, and thus told the terminal to stop (SIGSTOP). The fix is simply to press Crtl-Q. These correspond to stop and start in the output of stty -a. If this doesn't work try Crtl-a q, which is similar to the above, but gets screen to send it rather than the terminal on which you are connecting to the screen.

For more general freezing, one possibility is that a dead ssh is still attached to the screen. To fix, kill all your dead sshd processes. I assume this is caused by a send buffer filling up in the kernel, so that sending more data to the dead ssh blocks - it usually takes 10-20 seconds for this to show up.

(Taken from [1])

See Also

External Links