Intro Guide to SSH, GNU Screen, and irssi
So I finally got tired of explaining what GNU Screen is and how to use irssi with it so you can idle on IRC nets. To start, I'll draw a picture to help you visualize how this all works (I like drawing pictures, enjoy my MS Paint sillz).
Obviously I'm assuming you (the client) is on Windows, which if you're reading this, you probably are. Mac and Linux users, obviously just replace PuTTY with Terminal/OpenSSH. So I guess we'll go ahead and start with ssh.
Secure Shell (SSH)
So, when sshing from Windows, the easiest way is to use PuTTY (there are many ssh clients for Windows, personally I use Cygwin/OpenSSH/mintty, but PuTTY is quick and easy). When you start PuTTY it'll ask you where to connect, pretty straight foward. Just enter your username@linux.host.whatever like so:
It will ask you if you want to accept the public key of the server you are trying to connect to if it's your first time, that's fine, accept it. Then it'll ask you for a password, there will likely not be any feed back, don't worry, it is working.
Now you should be connected to your Linux box! Woot, now we can start talking about Screen and irssi.
GNU Screen
So to really understand how Screen works, you have to understand the concept of terminals / virtual terminals. In a nut shell, the way you interact with a Unix/Linux box is a terminal, which you run a shell on top of. So when you log into your Linux box you get your own virtual terminal to interact with the computer. Now, normally with just ssh, you get one virtual terminal per session, but what Screen lets you do is take that one terminal and use it to make more virtual terminals. But it does something else that makes it ideal for IRC idling, you can disconnect from those virtual terminals and completely disconnect from the box, login again, and then reattach to those virtual terminals. Pretty neat, eh? I think so
Alight, so now that you know more than you wanted, how do make use of it? Well lets start by starting Screen.
So my screen configuration has that neat little bar at the bottom that shows (from left to right) hostname, windows open / current window (red), and load averages on the server (had some problems with fork bombs.... better to keep an eye on 'em
) Anyways, I'll post my .screenrc at the end of this article if you want it.
So now that you're in screen, how do you interact with it? By default the "modifier key" is control+a. So what that means is when you press control+a (like select all in winderz) Screen then listens to what keys you press next. (Note: From now on I'll refer to control+a as ^a) (Note 2: after you press ^a you can let go, then press the next key) Anyways, here's a few basic commands you'll need to know:
- ^a + c Open New Screen Window
- ^a + n Next Window
- ^a + p Previous Window
- ^a + k Kill Window
- ^a + d Detach From Screen (i.e. drop to your ssh terminal)
- ^a + DD Power Disconnect (Detach from screen and log out of the server) (I like this one
) - ^a + ? Help window (gives some commands and descriptions)
Note that those are only a few, I would recommend at least looking at the help window, if not looking for a more in depth guide.
So now you know how to move around and use screen (kind of anyways) and maybe you decided to try detaching already and are probably wondering how to reattach. You still reattach with the screen command, but you'll need to pass it some arguments so it doesn't start a new screen session (you can have more than one). Now there are different ways to reconnect, but the easiest way assuming you're only running one screen instance is to run "screen -rD". What that tells screen to do is to reattach and disconnect everyone else from it. Why would you want to do that last part? Well if you accidentally disconnect uncleanly or leave yourself logged in somewhere, you won't be able to reattach before disconnecting those sessions, so just putting the -D on there makes screen always disconnect your other sessions.
Alright, now I know this isn't the easiest to follow, and I'm trying to be too complicated about this, I know it's hard to grasp all of this especially if you aren't used to a Unix like environment, but good job for making it this far!
So you have screen attacted and you're at a shell prompt, lets talk about irssi.
irssi (IRC Client)

Alright, so we're almost there now, you've launched irssi and just have to connect to your IRC Server. Start by doing a "/connect irc.whatever.stuff" and that will connect you to the IRC server you want to connect to. It'll probably look something like this after you have:
So at this point it's just a matter of doing a "/join #channel" to join the channel(s) you want to idle in. Remember to do a ^a + d to disconnect, not a /exit (that will exit irssi and defeat the purpose of running it in screen) and when you log back in to do a "screen -rD" to reattach to your screen session.
If you have any questions feel free to ask in the comments or in #geekboy!
Downloads
More Reading
- Highly recommend this one http://quadpoint.org/articles/irssi





September 15th, 2011 - 21:17
I feel like such a bauce using screen!