Posts Tagged ‘irc’

Quick Start Guide to IRC using Irssi & Screen

Sunday, October 14th, 2012

IRC isn’t as popular as it used to be but it is still thriving, especially in certain IT circles where users can interact in real time or collaborate on projects.

There are IRC clients for all operating systems including mobile devices (iPhone, Android, etc).  The problem I’ve found however with using an IRC client directly on a mobile device is most either disconnect you after a period of inactivity (or if the connection drops), or it drains the battery quicker.

Also, you may not want to always use IRC on your phone, and it would be nice if you can easily take over your existing IRC sessions on a different machine or catch up on what you missed in a channel if you got disconnected.

This is where screen comes into play.  Detailed usage of screen can be found here and I’m not going to pretend to be an expert in using it, but basically it allows you to open an interactive shell that keeps running even if you get disconnected from your terminal session. Not only can you reconnect to this session from the same machine you originated it from, but you can also take over this session from another machine (by SSH’ing into your machine from anywhere and taking over your screen session).

Screen can be used to run any program, but the benefit of running IRC through screen is if you get disconnected from your SSH terminal session, your screen shell is still running IRC and when you take back over your session later (or from a different machine or mobile device) you’ll be able to see all the channel activity that you missed while disconnected.

Here is a helpful tutorial that I used to get started with screen and irssi that goes into a lot more detail but for those who just want to get started as quickly as possible I wrote up the following cheat sheet to get up and running quickly.


My environment:

I’m running BackTrack in a virtual machine.  If you have a *nix machine already set up or have a full SSH shell somewhere that allows you to run screen and irssi then you can use that.  I’ve configured my machine so I can SSH into it from anywhere, which is the key to using screen/irssi from any PC or mobile device.  If your linux build doesn’t already have screen and irssi you’ll need to install these first (i.e:  apt-get install irssi).


cheat sheet:

start a screen session named “irc” running irssi:
screen -S irc irssi


Initial Config to Automate your IRC Login

You only have to perform the following commands once.  First, to register your screen name on the IRC server and then to set up irssi to automatically log you into your favorite server/channel each time. This part is optional but it will save you a lot of time/typing in the future.  Everything in red is what you should replace with your own info, including the irc server and channel you want to use.

The first command connects to the IRC Server you intend to use (in my case, The next command is to set your nick.  That will also tell you if the nick you want to use is already taken.  You wanting to find a nick not already registered so you may need to run that command a few times with different variations of the nick you want until you find one available.  The last command is to permanently register your chosen nick (check your email address after doing this for the verification email).

/nick yournick
/msg NickServ REGISTER password


Now, configure irssi to automatically log you into your favorite server and channel each time you launch it:

/NETWORK ADD -autosendcmd “/^msg nickserv identify nick password;wait 2000″ Freenode
/SERVER ADD -auto -network Freenode 6667
/CHANNEL ADD -auto #channel Freenode

(these settings get saved in the .irssi/config file on your machine. If something isn’t working right for some reason you can manually edit this file, I’ll include my config file at the end of this post for reference. If  I recall I did need to manually add or tweak the config a little so you may need to compare your config file with mine below if needed. Your mileage may vary.)



Once everything above is set up, using screen & irssi is simple.  To start your session:

screen -S irc irssi
(you will then be automatically logged in to your IRC server, nick, and channel)

To detach from your screen (and leave irssi running) hit:  “ctrl-a” and then “d


If you get disconnected from SSH, or want to take over your screen session from another SSH session, just type:

screen -x
(if you’re running multiple screen sessions, to connect to this specific one run ” screen -r irc -d” instead)


That’s really about it.  As long as you don’t actually /quit or /part from IRC (or reboot the machine where you initially started screen/irssi session), your irssi session will stay running indefinitely and you can hop around from PC to mobile device and just SSH into your machine and take over your screen session.

You can gracefully detach from your screen by typing “ctrl-a”, then “d”, as mentioned above but I haven’t really found a need to. I just leave it running, and then if I want to connect to it from somewhere else I just ssh to my machine and type “screen -x” and it takes over my screen session dropping me right back into IRC into my channel and all the previous activity of the channel is displayed as if I never left. You will be able to reconnect to your screen either way.

On your mobile device all you need is an SSH client so you can connect back to your machine.  You don’t need to run an IRC client.  If your mobile client disconnects your screen session is still running and you can just attach to it again, or later from another machine. On a Windows machine you can use the free SSH client Putty.

Use ctrl-p in irssi to switch between windows. Use Page-Up or Page-Down to scroll up or down in a channel.


My irssi config

Here are the relavent parts of my irssi config file (located in the .irssi folder). In case some part of the autologin aren’t working right for you, just compare these settings with your own and tweak/add entries as needed. (replace the red items with your details)


'servers' section:
address = "";
 chatnet = "Freenode";
 port = "6667";
 use_ssl = "no";
 ssl_verify = "no";
 autoconnect = "yes";
'chatnets' section:
Freenode = {
 type = "IRC";
 max_kicks = "4";
 max_msgs = "3";
 max_whois = "30";
 autosendcmd = "/^msg nickserv identify nick password;wait 2000";
'channels' section:
{ name = "channel"; chatnet = "Freenode"; autojoin = "yes"; }



There are a lot of other things you can do but this is basically all you need to get started. Have fun!