Text-based chat with Irssi

Special Chat

The Irssi console chat utility is powerful yet frugal with resources. And Irssi's scripting features make it a giant among chat tools.

By Mirko Albrecht

Irssi is a text-based, command line chat client. Don't make the mistake of thinking Irssi is old-fashioned, or restricted in its functionality; in fact, Irrsi beats some GUI-based contenders hands down with respect to feature richness and usability.

Irssi is a command line only tool, so first open a console, then type irssi to launch. The status window appears first; this is where server messages and help texts appear. The small [1] next to the time display shows you that you are in the first window.

You can now enter /connect irc.servername.com to sign on to the IRC server of your choice. Then enter a chatroom by entering /join #roomname or /j #roomname.

If you sign on to multiple servers, you can press [Ctrl]+[X] to toggle between servers - this assumes you are still in the status window. When you enter a chatroom, you automatically move to another window; the status line tells you which window number this is. The status line gives you the following details from left to right:

[Time][Your_Nick (+Userflags)][Window_number:#Roomname (+Channelflags)]

You can press [Alt]+[Window_number] to toggle between windows (that is, [Alt]+[1] takes you to the status window), or [Alt]+[arrow] to move to the next window. Pressing [Page-Up] or [Page-Dn] scrolls the window.

Figure 1: The Irssi website has numerous tips for the text-based chat program, along with various scripts and themes.

Good Connections

Before you start exploring the window tiling options, you might like to tell your computer to sign you on to the IRC network automatically when you launch the program. Typing /ircnet lists the preconfigured IRC networks. Irssi knows the major networks such as Efnet, Ircnet, Dalnet, and Freenode. If you would like to add a new IRC network, enter /ircnet add name. Irssi stores servers based on the following syntax:

/server add -ircnet network address port

The -auto option tells Irssi to connect to the server when the program is launched. For example, if you wanted to configure access to InsiderZ.de, you would first need to set up the network itself. Typing /ircnet add InsiderZ will do this for you. Now add a server on the InsiderZ network:

/server add -ircnet InsiderZ matrix.insiderz.de 6667

You can specify a channel as follows:

/channel add -auto #room network password

Again, Irssi can use the -auto option to join a channel when you launch the program. Command completion (like with Bash) is a positive side effect of storing connection data in this way. Let's assume you connect to Insiderz without using the -auto option; to find a chatroom, just type /conn[Tab] In[Tab]. Irssi will extend this to give you /connect InsiderZ. This works just as well with pre-configured chatrooms - /save will store your entries in ~/.irssi/config.


When you start typing in a chatroom, you are bound to notice a few things that you would like to change. For example, the status line at the bottom and the topic line at the top are hard to distinguish from the text window. Installing a theme helps you change this. There are a variety of colorful themes for the Irssi console at [2]. Just move the downloaded file, name.theme, to the ~/.irssi directory, and then load the theme by giving the /set theme name.theme command (Figure 2).

Figure 2: The website has any number of themes for downloading.

It is easy to lose track of which window belongs to which chatroom if you open multiple chatrooms at the same time. In Irssi, Perl scripts can solve this problem and many others, and there are lots of examples out there on the Web [3]. For example, you can use a script to integrate the text-based Mp3blaster MP3 player with Irssi, to hand URLs from the chat session to external programs, to add a simple calculator function to Irssi, and many other things.

The status bar shows the chatroom window numbers in which something has changed below [Act:]; this can be difficult to keep track of, if you have a large number of chatrooms. After all, how can you be expected to remember which channel is running in window number 8? To display the channel name along with the window number, just store the chanact.pl [3] script below ~/.irssi/scripts and run the /script load chanact.pl command to add the script. If you prefer not to run the script every time you launch Irssi, you should copy it to ~/.irssi/scripts/autorun.

You may be familiar with the multiple tab approach that GUI-based chat tools use to monitor multiple chatrooms. Irssi's window tiling approach is based on this functionality, but the program takes it a step further. /window show number allows you to drop the referenced window on top of the active window.

The balance, grow, and shrink options, for the /window command, influence the window size. The balance option distributes windows evenly across your screen; the other two options extend the current window upward or downward. To quit window tiling, enter /window hide number to return to the normal view. Even in tiled mode you can still toggle to a window by pressing [Alt]+[window_number], and thus enter the chatroom for that window.


A list of usernames at the right-hand edge of the screen is another feature that old hands might miss. Although you can type the IRC /name command to obtain a list of users, Irssi again has an graphical solution. Download the nicklist.pl [4] Perl script, version 0.4.6, and install the script as described earlier. It makes sense to create a copy of the script in ~/.irssi/scripts/autorun.

You need the screen console window manager to add a nicklist at the edge of the screen to Irssi - it should be pre-installed with most major distributions. Launch Irssi by typing screen irssi, type /script load nicklist.pl to load the script, and finally enable the nicklist by typing /nicklist screen (Figure 3).

Figure 3: A nicklist helps you keep track of your chat session. (See the list of names in the upper right corner of the screen.) To add the list, download and enable the Perl script.

You can modify the width of the bar by entering /set nicklist_width: experiment with numbers between 10 and 15 to set the width to your liking. /set nicklist_automode screen tells Irssi to give you a nicklist the next time you launch the program. The only slight niggles are that the script does not seem to support window split mode, and Irssi tends to flash rhythmically when you try to use the client in a remote session.

Some chatrooms host more than 100 users at the same time. Although not all of them might be typing at the same time, there is no way they are going to fit into the nicklist. The /nicklist scroll command can help you out here; and you can assign a keyboard shortcut to the command. This is how to do it:

/bind <i>key<i> command nicklist scroll -3
/bind <i>key<i> command nicklist scroll +3

Alternatively, open the ~/.irssi/config file in your favorite text editor and add the following lines at the end of the file:

keyboard = (
 { key = "meta2-P"; id = "command"; data = "nicklist scroll -3"; },
 { key = "meta2-Q"; id = "command"; data = "nicklist scroll +3"; }

The example gives you mappings for [F1] and [F2]. If you prefer to use other keys, a table at [5] tells you the right names for the various function keys.

Tips & Tricks

There are many more tricks that help you modify Irssi to match your requirements.It makes sense to check out the Irssi scripts at [3]. You will discover all kinds of topics from the useful to the gimmicky.

The fact that Irssi runs in a screen window is useful. Once you launch Irssi on X, it will stay in the background even if you close the terminal window inadvertently or deliberately (e.g., by quitting KDE/Gnome). As using screen is quite complicated, the following line might help:

alias irssi='if pgrep irssi;then screen -x irssi;else screen -S irssi irssi;fi'

You might like to add this alias to the .bashrc file in your home directory. What the command does is launch Irssi in a screen window and check if the client is running. If Irssi is still running, the command just continues the current session.

Irssi lets you define shortcuts for complex commands with innumerable options and parameters. There are two types of commands: those that you run quite frequently, but in a variety of scenarios, and others that you need Irssi to run every time you sign on to a server. You can use the autosendcmd option to handle the latter category. You can use a command of this type to register your own nickname with Nickserv. The following command adds this option

/ircnet add -autosendcmd "/^msg nickserv identify Password; wait -freenode 2000"freenode

The command signs you on to the Nickserv service on the Freenode network.

Frequent commands need a different approach: for example, the /msg chanserv set #roomname guard off command, which launches or removes the ChanServ bot - the automatic channel operator. You can use an /alias to define a shorter parameter, as follows:

/alias BOTOFF "msg chanserv set #roomname guard off"

Now, typing /botoff will remove the ChanServ bot.

Figure 4: Typing /hep in the status window gives you an overview of Irssi commands - and there are any number of useful help pages on the web.


The text-based Irssi chat client is a very powerful tool, and Perl scripts add almost unlimited extensibility. If you enjoy working at the command line, this program is definitely a good choice.

The sheer bulk of commands and settings can be frightening, even more so if you take a look at the scripts for controlling filesharing clients or the newsreader. But don't panic: you can decide which of Irssi's functions you actually use.

[1] Irssi download: http://irssi.org
[2] Irssi themes: http://irssi.org/themes
[3] Irssi scripts: http://irssi.org/scripts
[4] Nicklist script: http://wouter.coekaerts.be/site/irssi/nicklist
[5] Irssi keyboard mappings: http://wouter.coekaerts.be/site/irssi/keybindings