ii irc client

Over the years in my Linux journey, I’ve been slowly developing a soft spot for simple, lightweight (preferably terminal-based) applications over complicated bulky ones, why I’ve been slowly going through the process of substituting bulky, GUI-heavy apps for minimalist ones in my workflow; ranger for thunar, vim (with plugins) for Microsoft Code, etc.

Which brings me onto IRC clients, I’ve transitioned from irssi to weechat and back over recent years and as someone who loves discovering new apps, I came across a little gem called Irc it (ii), part of a collection of tools on the suckless site. What makes ii special is that it is a bare minimal FIFO filesystem-based IRC client and all you need to do is to use tail -f to follow conversations and echo to send your replies or commands to an IRC server.

To install ii, first clone its repo:

git clone https://git.suckless.org/ii
cd ii

then, copy the binary (ii) to your bin folder.

The command syntax for running ii is:

ii <-s host> [-i <irc dir>] [-p <port>] [-u <sockname>] [-n <nick>] [-k <password>] [-f <fullname>]

for example, for the freenode IRC network, the command will be:

ii -s chat.freenode.net -n your_nick

and to identify your nick, the command will be:

echo "/j nickserv identify your_nick_password"> irc/chat.freenode.net/in

If you didn’t specify a directory where you you want your ii files stored, ii will by default store your files in a folder named irc on your user home directory, once connected to the freenode network, you can join a channel by echoing the name of the channel you want to join to the in file which would have been created by ii as follows:

echo "/j #archlinux" > ~/irc/chat.freenode.net/in

The newly created irc folder structure would look like this once you’ve connected to an IRC server and added some chat channels:

└── chat.freenode.net
    ├── #android
    │   ├── in
    │   └── out
    ├── #archlinux
    │   ├── in
    │   └── out
    ├── chanserv
    │   ├── in
    │   └── out
    ├── in
    ├── nickserv
    │   ├── in
    │   └── out
    └── out

Following the above commands will get you up and running with ii and connected to an IRC network like freenode but without SSL/TLS support as ii by itself doesn’t support it. So trying to connect to freenode on port 7000 for an SSL-encrypted connection will not work.

To get SSL/TLS support for ii, we need to use a program that can add SSL/TLS functionality to a program, I came across a guide online that used OpenBSD’s relayd, unfortunately, I couldn’t find any package for ArchLinux so I settled for stunnel instead. Using stunnel for ii on ArchLinux is pretty straight-forward. Install from the official Arch repo and then create a config file as follows:

setuid = stunnel
setgid = stunnel
CAfile = /etc/ssl/certs/ca-certificates.crt
verify = 2

client = yes
accept =
connect = chat.freenode.net:6697
verifyChain = yes
CApath = /etc/ssl/certs

Afterwards, start the stunnel systemd service by running:

sudo systemctl start stunnel.service

You can then start ii and connect for example to freenode using port 6697(6667) for a SSL-encrypted connection:

ii -n your_nick -s -p 6667

Now, entering the above command everytime you need to connect to an IRC network seems cumbersome, I wrote a small script to automate the process of connecting to a typical IRC network like freenode, identifying your nick, and then connecting to any chat channel of your choosing. The script below connects to the freenode IRC network through SSL (you must have the stunnel service running before running this script), and connects to the archlinux and android freenode channels.

ii -n your_nick -s -p 6667 &
sleep 10
echo "/j nickserv identify your_nick_password"> $HOME/irc/
sleep 10
echo "/j #archlinux" > $HOME/irc/
echo "/j #android" > $HOME/irc/

Once you get ii up and running, you can watch conversations on a chat channel by running:

tail -f irc/\#archlinux/out

in a terminal.

ii chat window

Now the above screenshot only shows one channel, meaning one would need to have multiple windows open for multiple chat channels, this is not a good way to work. Enter Multitail, which is a program that according to its website - “allows one to monitor logfiles and command output in multiple windows in a terminal, colorize, filter and merge”

Multitail is available in the official Arch repo and once installed, create a .multitailrc file in your home directory with the following contents:

cs_re_s:yellow:(((http|https|ftp|gopher)|mailto):(//)?[^ <>\"[:blank:]]*|(www|ftp)[0-9]?\.[-a-z0-9.]+)
cs_re:cyan:.*has joined #.*
cs_re:blue:.*changed mode.*

titlebar:%m %u@%h %f (%t) [%l

Afterwards, with the stunnel systemd service and ii running in the background, run the following in your terminal:

multitail -CS irc -f $HOME/irc/ -f $HOME/irc/

Screenshot of the above command in action is show below:

Multitail Window

I run i3-wm on my Arch system, so I find it convenient to use a keybind for the multitail command , in my i3 config I have this line:

bindsym $mod+i exec urxvt -e multitail -CS irc -f $HOME/irc/ -f $HOME/irc/

The line above launches a multitail window showing the archlinux and android IRC channels.

You can of course use multitail to monitor more than two IRC chat channels at the same time and also use it to manipulate colors and window positioning as you deem fit.

If you don’t want to ‘echo’ every IRC message, you can use vim, just cd into the irc folder and open vim from there, type your message(s) and then switch to vim’s normal mode and press : on your keyboard to enter command mode, then for example to post what you’ve just written in vim to the archlinux channel, type this .w >> \#archlinux/in and press Enter. That’s it, you can keep the vim window open to post messages to any other IRC chat channel..

I have to admit that setting IRC it (ii) up hasn’t been totally straight-forward and easy as I’d hoped mostly because it required taking some extra steps to get it working safely and securely, one positive is that the setting-up process led me to discover some amazing new handy applications like multitail, exciting to think of many other ways that I can utilize it in my workflow.

· archlinux, linux