IRC

From Sudo Room
Jump to: navigation, search

NOTE: a lot of people think that you can get on IRC and talk to people right away. That only works if people are in the channel you want at that very moment, and paying attention to that screen on their computer.

The reality is that most conversations in IRC happen over hours or days, so the only way to fully experience a channel such as #sudoroom is to find a way to stay logged into IRC continuously. If you have a desktop computer that stays powered on and connected to the internet, this is easy. Otherwise, you need to connect to a computer that stays on (such as a server) and leave an IRC session running there, using "screen" or "tmux" as described below.

If you log into IRC and say Hello and nobody gets back you to you for an hour, that is totally normal. If you log out five minutes after asking a question, people will make fun of you an hour later when they look at their IRC sessions.

Internet Relay Chat (IRC) is an instant messaging service that has been used on the internet since the early 1990s. IRC is made possible by the Internet Relay Chat Protocol (IRCP), an application layer protocol. The chat process works on a client/server networking model. IRC clients are computer programs that a user can install on their system. These clients communicate with chat servers to transfer messages to other clients. IRC is mainly designed for group communication in discussion forums, called channels, but also allows one-on-one communication via private messages as well as chat and data transfer, including file sharing.

Many other instant messaging services exist, however many services are proprietary and/or rely on a centralized platform. This does not appeal to organizations that wish to establish a channel of communication that can be adopted by users without fear of unwanted regulations by the service/platform provider. Although open source protocols such as XMPP (formerly Jabber) exist, IRC continues to be used because it is lightweight and stable.

IRC consists of channels. Each channel is like a chat room, and is represented by a name that begins with '#' followed by a string that represents the primary topic of the channel. Examples: #html, #css, #javascript, #go-lang.

Recommended Clients

There are many various IRC clients available for many platforms.

Graphical Clients

Command Line Interface Clients

These clients are intended to be used from the command line interface (CLI), also known as the "terminal".

Basics

For those that are new to IRC, it’s a good idea to become familiar with the common commands that IRC programs support. Here are a few:

Command Example Description
/join #channel_name /join #sudoroom Join a channel
/me <action> /me waves hello Announces some action
/msg <nickname> <message> /msg juul Hey! I need some help Send a direct message to another user
/ignore <nickname> /ignore annoyingperson Block someone that is harassing you

Although the above commands are likely to be supported by all IRC client programs, some only apply to specific clients. The following are supported by irssi:

Command Example Description
/help /help View documentation on supported commands
/help <command> /help connect View documentation on a specific supported command
/connect <server address> <port> /connect irc.freenode.net 8001 Connect to an IRC server
/set nick <nick> /set nick someGuy2015 Register your nickname with the IRC server/network
/set real_name <real name> /set nick Bill Murray Register your real name within the IRC server/network
/quit /quit Quits IRC program
/exit /exit Quits IRC program

See IRSSI Documentation for more commands.

FreeNode

Many programming/hacking communities establish a channel on the FreeNode IRC network to facilitate discussions and provide support to members of their community.

Registering with FreeNode

The FreeNode IRC network allows you to register your nickname and associate it with your email address. This is done by using the following commands:

 /msg nickserv REGISTER <password> <email>

You should receive a message informing you that you need to check your email account and obtain instructions to verify yourself.

To make sure that your email address isn’t revealed to other users, use the following command to ensure that it is hidden.

 /msg NickServ SET HIDEMAIL ON

You can verify your information with the NickServ by using:

 /msg nickserv info

Persistent CLI Client

This section is a guide to setting up a command line based IRC client on a persistently running machine so that it stays connected within a channel even when you are not connected to the machine via SSH. This results in the ability to reconnect and view the messages in the channel that occurred even when you were not connected.

These instructions assume you are using an Ubuntu machine, and will be using the irssi client.

Client Machine

You can setup a system at home and configure your home network device(s) to make that machine available via the internet, or alternatively gain shell access to a server on the internet. There are services that provide free or paid shell access, with features and support for IRC that varies. Some of these services even provide support for IRC bots. Alternatively you can pay for a Virtual Private Server (VPS) for as low as $5 a month through services such as [digitalocean.com DigitalOcean], thus providing you with an entire UNIX-like server environment that you can use as you wish.

Install Client

Install the irssi client using the following command:

 apt-get install irssi

After it’s done installing, simply run the program

 irssi

Configure

There is a configuration file in ~/.irssi/config that you can inspect, but you can use commands from within the program to configure IRSSI to automatically perform when you first open the program.

The following commands will configure IRSSI to connect to the Freenode network with an SSL connection, with automatic joining of the #sudoroom channel.

 /network add Freenode
 /server add -auto -ssl -ssl_verify -ssl_capath /etc/ssl/certs -network Freenode irc.freenode.net 7000
 /channel add -auto #sudoroom Freenode
 /save

After you’ve successfully registered your FreeNode nick name, you can run this command to configure IRSSI to login automatically after connecting to FreeNode.

 /network add -autosendcmd "/msg nickserv identify <password> ;wait 2000" Freenode

Windows

irssi support separate “windows” for the different channels you are connected to, or for the different people you are chatting with. If for some reason you do not see information on the screen for a command you’ve run, it may be displayed in another window.

An Ubuntu terminal can use the ALT key combined with a number key (e.g. ALT+1, ALT+2, ALT+3, etc) to switch between the different displays in IRSSI. This will not work via SSH however, so you will need to use the /window command instead.

 /WINDOW NEW                    - Create new split window
 /WINDOW NEW HIDE               - Create new hidden window
 /WINDOW CLOSE                  - Close split or hidden window
 
 /WINDOW HIDE [<number>|<name>] - Make the split window hidden window
 /WINDOW SHOW <number>|<name>   - Make the hidden window a split window
 
 /WINDOW SHRINK [<lines>]       - Shrink the split window
 /WINDOW GROW [<lines>]         - Grow the split window
 /WINDOW BALANCE                - Balance the sizes of all split windows

Managing Process

You can use GNU screen or tmux to maintain a terminal session that will persist even after you disconnect from the SSH session on your client machine.

For example, you can run 'screen' to start a screen session. Once the session is started, run any program you wish. To disconnect from the session press CTRL-A, followed by D key. You can then safely disconnect from your SSH session. When you return, use `screen -r` to reconnect.

See How to use screen and irssi and IRSSI Using Screen and SSH