Discover the World of IRC

Back to Basics

Article from Issue 198/2017
Author(s):

Drop Discord. Say goodbye to Slack. The real way to communicate online is IRC – here's why it still rocks.

The number of chat and discussion services competing for our attention is growing at a bewildering pace. Take a typical smartphone and its methods for communication: It'll probably have SMS, Facebook Messenger, Google Hangouts, WhatsApp, and Telegram. Then, add a few phone-specific services on top. Every other day a new app arrives promising to be the ultimate solution for all of our communication woes – but it just becomes another annoyance filling the notification bar.

And there's another problem: Most of these services are proprietary and centralized. If WhatsApp's servers go down (unlikely, as they're running on FreeBSD), then there's nothing that the service's vast user base can do. Well, apart from enjoying a few moments of peace and quiet, of course. The Internet was created as a distributed network that could route around problems, yet we're increasingly reliant on highly centralized services run by single companies. It's not how things were meant to be.

So, in this article, I'll examine the state of Internet Relay Chat (IRC). This is an open protocol for real-time, text-based communication that is older than the web, and most importantly, it's decentralized. Anyone can run IRC server software, and it's possible to add multiple computers to the same IRC server to create a network, providing backups in multiple locations in case one machine happens to go down. IRC may not offer all the fancy bells and whistles of other communication services, but it's proven, reliable, and still widely used – especially in the free and open source software community.

A Bit of Background

IRC was originally developed in Finland in 1988, as an attempt to expand a bulletin board system (BBS) with real-time chat features. One year later, 40 IRC servers across the world were in operation; that might not sound like a huge figure, but bear in mind that this was before the web, and very few people had Internet access at home. Multiple distinct IRC networks popped up, offering their own sets of features and topics, and it soon looked like IRC could become fragmented.

Fortunately, a standard for the protocol was created in May 1993 as RFC 1459 [1]. An RFC is a Request For Comments – a document by the Internet Engineering Task Force (IETF) that aims to provide a reference for future implementations of a protocol. So, despite a few early bumps in the road, IRC got off to a good start and became the most popular way to communicate online in the late 1990s (Figure 1).

Figure 1: The IRC protocol is open and defined in an RFC from 1993.

Some of the most popular IRC networks of the time were Dalnet, EFnet, and IRCnet. Today, one of the most popular networks in the FOSS world is Freenode, which is hosted by 32 servers working in tandem. When you connect to Freenode, you connect to one of those 32 servers on the network, but as they're linked together you can still communicate in real-time with users connected to a different machine on Freenode. At any given time, there are about 90,000 users on Freenode, chatting in about 40,000 channels.

But what exactly is a channel? Think of it as a chat room – a place with a specific topic where a bunch of people get together to discuss it. For instance, Freenode has an Ubuntu channel to ask questions and discuss that distro; there are channels for LibreOffice, the Linux kernel, and many other FOSS-related topics as well. Anyone can create a new channel and invite users to it, although the vast majority of the 40,000 channels on Freenode are silent or virtually empty.

IRC is popular in geek circles for many reasons. Although it's real-time – so when you type a message everyone else in the channel sees it pretty much straight away – it's not like a team call where you're expected to answer at any moment. IRC users have nicknames and can direct messages at each other using these. So, you could be in a very busy IRC channel and not pay much attention to the general chat until someone mentions your nickname specifically, in which case your IRC software (aka "client") will notify you in some way. This could be a sound, or bold text on the specific line, or something in your notification area.

Take the LibreOffice team as an example: There are channels for development, QA, design, documentation, and other topics. Many LibreOffice contributors join all of these channels, but rarely take part in conversations unless they are specifically asked a question. It's also common for participants to add "_afk" to their nicknames – which means "away for now" – so other users know not to expect an immediate response.

Going Hands-On

That's enough background; let's see IRC in action. Because IRC is an open protocol, anyone can implement a client program to access a network. And – as you'd expect in the FOSS world – there's a huge range of clients to choose from. Our favorite graphical client is HexChat [2] (Figure 2), but we recommend learning the text-based commands for using IRC, so install the very awesome Irssi [3] client in your distro's package manager and start it up in a terminal by entering irssi.

Figure 2: If you prefer a graphical IRC client, HexChat (based on XChat) is one we highly recommend.

You'll see… not a lot. By default, Irssi will sit there waiting for you to issue commands, and the first thing you need to do is connect to an IRC server. So enter this:

/server chat.freenode.net

Here you can see that IRC commands begin with forward slashes, followed by parameters. All we do here is tell Irssi to establish a connection to the IRC server (daemon) running on the host chat.freenode.net. Irssi does a bit of handshaking with the server, identifies itself, and then we're connected.

But still, not much else is going on. We can't chat to anyone at the moment, because we haven't joined any channels. Let's fix that:

/join #ubuntu

Note that channels are typically prefixed with hash (#) marks. This command opens up a new window in Irssi; you'll see the topic of the channel at the top, providing some information about the latest release and links to useful information (Figure 3). It's good IRC etiquette to always read the topic of a channel when you join – especially if something important has just occurred and everyone is talking about it. (See the "IRC Etiquette" box for more information.)

IRC Etiquette

In general, good behavior on IRC is the same as elsewhere on the Internet: don't troll, don't type in ALL CAPS, and be patient if you ask a question. One big no-no on IRC is "flooding" – that is, pasting lots of text into your IRC client. You might be tempted to do this if you have something genuinely useful to contribute, such as some code or a chunk of a log file, but it's very bad practice. Users who are temporarily away from the channel and switch back to check what's going on will just see your pasted text and have to scroll around to see what the context is. Instead, use a site like Pastebin [4] and then send the link to the IRC channel.

When you're joining a new channel, it's a good idea to watch the channel for a few minutes to get a feel for the discussion and general behavior of the participants. You can say hello and introduce yourself on smaller channels; on larger ones, like #ubuntu, that could be interpreted by some users as overly trivial and distracting from real conversation. If you want to ask a question but aren't sure whether it's suitable for a particular channel, you can ask politely beforehand: "Hi – are questions about X allowed here?"

Figure 3: Irssi may look a bit cluttered when you first start using it, but you'll soon come to grips with its interface.

Next, you'll see a list of nicknames, surrounded by square brackets. These are participants in the channel, and those with @ characters before their names are operators (aka ops) – they have special privileges to change the topic, ban users, and perform other jobs.

The next thing you'll want to do is set your nickname. Use the following:

/nick SomeNameHere

Use whatever name you like, but if it's already taken, you'll have to choose something else! (To register your nickname so that only you can use it, see the "Registering a Nickname" box.) Now you can start chatting away – any text you type, followed by Enter, will appear in the channel for all to see. If you want to alert a specific user in the channel, you can type the first few letters of his/her nickname and use tab completion. Then, you can type something like the following to notify them:

SomeGuy: Have you downloaded the latest release?

Registering a Nickname

Most IRC networks let you register a nickname so that only you can use it. This is important to prevent other users from pretending to be you, causing trouble and trolling. To register, you need to communicate with a special bot user called "nickserv" – the nickname server. This isn't a real person but simply handles the job of registering and confirming nicknames.

Once you've got a nickname you like, enter this:

/msg nickserv register <password> <email address>

This sends the "register" command to the nickname server, with a password that you specify and your email address. A validation message will be sent to your inbox, so check it and then enter the verification command provided.

From here on, whenever you log on to the IRC network you can identify yourself like so:

/msg nickserv identify <nickname> <password>

If anyone else tries to use your registered nickname when you're not online, nickserv will tell them that they need to identify first – so you're protected.

You can also join other channels – there's a good list of the most popular ones (and a search tool) on the web [5] (Figure 4). Try searching for topics that interest you – software, programming languages, music, sports, and more. You'll see the channel names along with the number of participants, so you can immediately get an impression of how busy the channels are.

Figure 4: On irc.netsplit.de, you can search for channels covering various topics across many IRC networks.

You can switch between windows for the channels using Alt along with the number keys – so Alt+1 for the status information from the IRC server, Alt+2 for the first channel you joined, Alt+3 for the second, and so forth. You can see the current window number, plus the server and channel, in the status bar at the bottom; it's in the second section, after your nickname.

Meanwhile, you can use Alt+P and Alt+N to scroll back and forward through the chats – this is very helpful if there's a lot of activity going on and you need to catch up. In the Irssi status bar, you'll see things like this:

[Act: 2]

That means there is activity in the second window. If the number is purple, someone has mentioned your nickname – so you'll probably want to switch to that window, read the message, and respond accordingly. To close a window, enter /wc, and use /quit to disconnect from the IRC network and terminate Irssi.

Super Scripts

Irssi is a great IRC client on its own, but it can be expanded with extra features and functionality using Perl scripts (Figure 5). These should be placed inside your .irssi/scripts/ in your home directory and can be loaded using the /script load command followed by the script name (omitting the .pl extension). Before we try some scripts, let's see how they work. In ~/.irssi/scripts/, create a text file called foo.pl with the following contents:

use Irssi;
Irssi::command_bind hello => sub {
    print 'Hello, world!';
};
Figure 5: Here's Irssi with some extra scripts installed to provide an advanced window list and bar showing recent activity.

This is a very simple script that adds an extra command to Irssi: /hello. As you can see, it simply prints the text "Hello, world" to the screen (note that it doesn't actually send it to a chat channel). With this file saved, go back to Irssi and then enter the following commands:

/script load foo
/hello

Et voilà – the "Hello, world" message appears on your screen. If you're already a dab hand at Perl, you can try to write some more complex scripts; there's a useful introduction tutorial online [6].

Now, on the official Irssi scripts site [7], you'll find a huge number of scripts to do very cool (and sometimes pointless) things in IRC. By default, these are listed alphabetically, but if you click the Votes link on the right-hand side a couple of times, it will show the scripts with the most votes at the top. One of our favorite scripts is the mightily useful Trigger [8], which is like a Swiss army knife of scripts. It lets you define commands to be executed when certain events or actions happen in IRC – effectively letting you create your own automated IRC bot without having to learn lots of scripting.

When you have it installed and loaded, enter /trigger help to get an overview of what it can do. You can use regular expressions to match certain conditions and then perform an action automatically, such as banning a user if he or she uses certain words (e.g., swearing).

Another useful script is adv_windowlist, which as the name suggests provides an advanced window list inside the IRC client. When you load this, after a few moments a list of available windows is displayed down the left-hand side of your screen; they are also colored accordingly depending on activity. If you have the screen space, it's well worth installing, as it makes it much easier to navigate between windows (rather than trying to keep track of things in the rather cluttered status bar).

Then there's trackbar22. This is truly a godsend if you monitor multiple channels, as it shows you the exact point where you last looked at a window. For example, say you're watching the #ubuntu channel but then you switch to a different window for a few minutes. When you return to #ubuntu, if there has been a lot of activity in the meantime, you'd have to scroll around a while and try to remember where you last saw the discussion. This isn't always easy, but with trackbar22, you'll see a horizontal line showing exactly when you stopped viewing that window. So, simply scroll up to the line, and you can catch up at the exact point where you left the discussion.

There are many other scripts worth investigating, some of which beef up Irssi with advanced user interface features and make it easier to keep track of busy discussions. Enjoy your time on IRC, and let us know if you discover any especially awesome Linux and FOSS-related channels that we should mention in the magazine!

Buy this article as PDF

Express-Checkout as PDF
Price $2.95
(incl. VAT)

Buy Linux Magazine

SINGLE ISSUES
 
SUBSCRIPTIONS
 
TABLET & SMARTPHONE APPS
Get it on Google Play

US / Canada

Get it on Google Play

UK / Australia

Related content

  • Irssi

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

  • Charly's Column

    Have you ever felt frustrated because you were looking forward to a chat session but didn’t have access to a client? Firewalls, or simply not having access to your own machine, can be frustrating. Wth CGI:IRC, all you need for IRC is a web browser.

  • FOSSPicks

    Graham Morrison looks at KIT Scenarist, Inboxer 1.0, Tungsten, rtl_433, Oil 0.3.0, Etcher 1.3.0, and more!

  • FOSSPicks

    Graham looks at Krita 4.0, FreeTube 0.2.0, OpenSnitch, Yoda, Citybound, GZDoom, and much more!

  • Voice Chat with Mumble

    The Mumble server lets you hear your multiplayer game opponents over VoIP, freeing you from inconvenient text chat during game play.

comments powered by Disqus

Direct Download

Read full article as PDF:

Price $2.95

News