Linode Library Home
Linode Library RSS Feed
Home :: Communications :: IRC Guides
Print View View Source

Using Irssi for Internet Relay Chat

Published: by

Irssi is a terminal-based Internet Relay Chat (IRC) client for real-time conversations. IRC is a chat program and the common meeting ground for Linode users to exchange knowledge, troubleshooting issues, and ideas.

Irssi may be run on any Linux, Unix, or MAC OS X environment, either from your local workstation or your Linode. Many Linode users prefer to run Irssi from their Linodes to take advantage of the reliable connectivity and uptime. If you are unfamiliar with using a Linux terminal, you may want to review the Linode Library guides for using the terminal and using Linux. Additionally, it is assumed that you have followed our Getting Started Guide if you intend to run Irssi on your Linode.

Contents

Introduction to IRC

IRC is a centralized system with a number of different providers hosting independent, non-connected networks. Every IRC network hosts a number of different channels or chat rooms that users may join and part at will. Channels are generally organized by topic. IRC also has the ability for users to have one-on-one private conversations.

Channels have unique identifiers beginning with a hash/pound (#) sign. For example, Linode users utilize the #linode channel on the OFTC network. Often channels on one network are not related to channels with the same name on other networks.

All users select a unique nickname or nick as their screen handle when connecting to IRC. Some channels have users who monitor and administer the settings and operations of that channel. These users are referred to as operators or ops. Their nicks are usually preceded by a special character (e.g. @,``&``, or ~). Most nicks are claimed on a first come, first served basis. Note: you may change your nick at any time while connected to an IRC session.

Installing Irssi

To install Irssi on a Debian or Ubuntu system, issue the following command:

apt-get install irssi

To install Irssi on Fedora or CentOS system, issue the following command:

yum install irssi

To install Irssi on Arch Linux systems, issue the following command:

pacman -S irssi

To install Irssi on Mac OS X systems, with MacPorts installed, use the following command:

port install irssi

To install Irssi on Mac OS X systems with HomeBrew, check for new Brew recipes before you install Irssi. The following commands will update Brew and install Irssi:

brew update
brew install irssi

Configuring Irssi

If the directory or configuration file is not created during the first run of the Irssi command, you will need to manually create the directory and config file to store your settings. The procedure is outlined below:

mkdir ~/.irssi
nano ~/.irssi/config

Note: the text editor nano was used for example purposes only. Use the text editor that you are most comfortable with.

Adding IRC Networks

Below is a sample Irssi configuration file. In the first address field the OFTC network as been selected. In the second address field the Freenode network has been selected. Both of these networks have been set to autoconnect = "yes", which means every time you connect to Irssi, you will be connected to these networks. Make any changes you want according to what chat networks you prefer.

   servers = (
   {
       address = "irc.oftc.net";
       chatnet = "oftc";
       port = "6667";
       #port = "6697";
       # use_ssl = "yes";
       # ssl_cert = "~/.irssi/certs/[NICK].pem";
       # ssl_verify = "yes";
       # ssl_cafile = "~/.irssi/certs/CAs.pem";
       autoconnect = "yes";
   },
   {
       address = "irc.freenode.net";
       chatnet = "freenode";
       port = "6667";
       autoconnect = "yes";
   },
);
   chatnets = {
     oftc = {
       type = "IRC";
       max_kicks = "4";
       max_msgs = "3";
       max_whois = "30";
       autosendcmd = "";
   };
     freenode = {
       type = "IRC";
       max_kicks = "4";
       max_msgs = "3";
       max_whois = "30";
       autosendcmd = "";
   };

In order to use a SSL certificate with OFTC, you will need to remove the pound (#) sign from the five lines in the first block under servers = and comment out the first port declaration (port = "6667"). See OFTC's certificate instructions for more details.

Adding Default Channels

The following sample contains the syntax for configuring additional channels. These settings are located in the Irssi config file.

File excerpt:~/.irssi/config

channels = (
  { name = "#linode"; chatnet = "oftc"; autojoin = "yes"; },
  { name = "#awesome"; chatnet = "oftc"; autojoin = "yes"; },
  { name = "#ikiwiki"; chatnet = "oftc"; autojoin = "yes"; },
  { name = "#stumpwm"; chatnet = "freenode"; autojoin = "yes"; },
  { name = "#stringtheorists"; chatnet = "oftc"; autojoin = "yes"; },
  { name = "#stringtheorists"; chatnet = "freenode"; autojoin = "yes"; },
  { name = "#org-mode"; chatnet = "freenode"; autojoin = "yes"; },
  { name = "#lisp"; chatnet = "freenode"; autojoin = "yes"; },
  { name = "#emacs"; chatnet = "freenode"; autojoin = "yes"; }
);

Note that you may add as many channels as you like.

Configuring Default Nickname ("Nick")

The information needed to set your nick is found in the Irssi config file. A sample is provided below:

settings = {
core = {
real_name = "Morris Squire"; user_name = "squire"; nick = "squire";

You do not have to use your real name in the real_name variable. However, if you choose to do so, your name will be publicly accessible to every user in the IRC network you are connected to.

Configuring "Hilights"

Hilight settings tell Irssi to notify you when certain words are used in the channels you have joined. If there are particular words or topics that you want to keep track of, you may add them to this section.

hilights = (
  { text = "foreman"; nick = "yes"; word = "yes"; },
  { text = "squire"; nick = "yes"; word = "yes"; }
);

When you finish editing the ~/.irssi/config file to your satisfaction, save and exit the text editor.

Starting Irssi and Connecting to an IRC Network

Start Irssi by entering irssi at a terminal prompt. For security purposes, it is strongly recommended that you do not run your Irssi session as the root user.

You need to be connected to a network before you can begin using Irssi. In the section Adding IRC Networks we configured the freenode and OFTC networks. The commands for connecting to these networks are as follows:

/connect oftc
/connect freenode

If any networks and/or channels have been set to auto join, your client will join those networks/channels once the connection has been made.

Always make sure that when you are viewing the status window and issuing commands to Irssi that you have selected the proper network. You may switch between networks by using Ctrl-x.

Irssi Commands and Usage

All commands in Irssi are preceded by a slash (/). When Irssi starts for the first time, your status window is usually labeled as number 1. Each channel you join as well as any private messages you receive will appear in its own window. A prompt down on the left-hand side will display the name of the active window.

The table below includes a list and brief description of the Irssi commands.

Command Description
/ban Sets or lists bans for a channel
/clear Clears a channel buffer
/disconnect Disconnects from the network that has focus
/exit Disconnects your client from all networks and returns to the shell prompt
/join Joins a channel
/kick Kicks a user out
/kickban Kickbans a user
/msg Sends a private message to a user
/names Lists the users in the current channel
/query Opens a query window with a user or closes a current query window
/topic Displays/edits the current topic
/unban Unbans everyone
/whois Displays user information
/window close Forces closure of a window

To type a message in a window, navigate to the window you want to comment in and once that window is active type your message, then hit enter. The specific command for navigating to a window is shown below (replace <number> with the actual window number)

/win <number>

More details about navigating between windows will be covered in the next section.

To send a private message (or PM) you will need to know the nick of the person you would like to message. Remember to replace the <nick> with the user's nickname, type a message, and hit Return when you are done. The private message will now appear in a new window (if no window is already associated with the present private message). This message cannot be readily viewed by anyone but you and the message recipient. Below is a sample of the private message command:

/msg <nick> <message contents>

Note

Please note that if you are in a channel you can use tab to auto complete nicks within that channel. This is useful for sending PMs or hilights.

Messages are not encrypted and should not be considered secure communications. Lastly, there is no spell check feature in Irssi.

To join or part an IRC window use the following commands:

/join #linode
/part #linode

Again the channel name #linode is used for sample purposes. Be sure to change the name to the channel you would like to connect to or part from.

Managing and Manipulating Windows

An Irssi window is not actually a window in the typical sense. Where windows are usually individual boxes which run different programs, in Irssi the windows are all running the same program but the messaging is occurring on different layers. All the windows are numbered sequentially based on the order they were joined so usually the status window is number 1.

To change to a different window, select it using the Alt key (alternately, M or Meta) plus the window number. In some terminal emulators this is also the escape (e.g. Esc) key. You may need to modify the settings of your terminal emulator to ensure that the proper signals are set to Irssi. In Mac OS X's Terminal.app, this requires selecting the Use option as meta key option under the Keyboard tab of the settings preference pane. For the rest of this section we will refer these Alt- bindings as M- bindings.

Window numbers 1 through 10 are number 1 through 0 on the keyboard, and can be accessed by using the keybindings M-1 through M-0. Windows numbered 11 through 19 are accessed by using the key bindings M-q through M-o. Irssi supports more than 19 windows, though windows 20 and up are not accessible by key bindings and need to be accessed by some other manner. You may issue a command in the form of /window <window-number> to change focus to the selected number. The following /window commands may be useful:

  • /window list - generates a list of all windows, along with their number (e.g. Ref), channel or purpose (e.g. Active item), and IRC network (e.g. Server). The window list will appear in the status window. Below is a sample of the output from a windows list command.
Window list output sample.
  • /window goto active - changes the focus of the current window to the window with the highest amount of activity and the lowest identifier. The "highest amount of activity" is ranked by: messages directly to you (either private messages or with references to your nick), then all other messages in a channel, and then other activity (e.g. topic changes, joins and parts) in channels. This command is bound to the key combination M-a or Alt+A.
  • /window next - moves the current focus to the next window in sequence. In this context the highest numbered window is immediately before window number 1. This command is bound to the key combination C-n or Ctrl-n.
  • /window previous - moves the current focus to the previous window in sequence. In this context window number 1 is immediately before the highest numbered window. This command is bound to the key combination C-p.
  • /window close - closes the currently selected window. If you connect to a channel and close the window, the channel will close without issuing the /part command. The abbreviated form of /wc may also be used to close a window.

Managing IRC Nicknames

If you want to change the nickname you received when you signed on, use the nick command. For example:

/nick not_squire

This will change your current nickname to not_squire if that nickname is not in use. If the nickname is in use, a message in the status window will tell you that the nickname is unavailable.

Make sure that you issue nickname change requests in the context of the proper IRC network, either by switching to a window that belongs to the proper server or by using the status window and C-x. Additionally, be aware that when you change nicknames, every channel that you are joined to will receive (and display) a message alerting the participants of those channels that you have changed nicks.

If you want to gather more information about an IRC user, you can use the /whois <nick> command. For example, you may send the following command to Irssi:

/whois squire

Irssi might then produce output similar to the following:

11:45 -!-  squire [for@example.com]
11:45 -!-  ircname  : Cecil Sharp
11:45 -!-  channels : #linode
11:45 -!-  server   : sample.oftc.net [Galloway, NJ, US]
11:45 -!-           : user has identified to services

The ircname value corresponds to the value set in the realname setting that users provide to their IRC clients. for@example.com identifies the physical machine that the user is signed in through, although some users are able to mask this information. In short, while you may be able to gather some useful information from the output of /whois, this information should be assessed with careful consideration. /whois commands, like nick change and channel joins, are context specific for the current IRC network.

Disconnecting and Exiting Irssi

You can disconnect from an IRC network by using the /disconnect command. By default, this command will disconnect Irssi from the network that has focus. You can disconnect from another IRC network by specifying the network as an argument to the command. For example:

/disconnect freenode

Additionally, if you need to exit the entire Irssi program you can use the /exit command which will disconnect your client from all networks and return you to the shell prompt.

Please note: Unlike many other clients, the /quit command will quit Irssi rather than disconnect you from the network.

More Information

You may wish to consult the following resources for additional information on this topic. While these are provided in the hope that they will be useful, please note that we cannot vouch for the accuracy or timeliness of externally hosted materials.

Creative Commons License

This guide is licensed under a Creative Commons Attribution-NoDerivs 3.0 United States License.

Last edited by Bobbi L on Tuesday, January 14th, 2014 (r4089).