Community Pick: Many members of our community have endorsed this article.
Editor's Choice: This article has been selected by our editors as an exceptional contribution.

IRC (Internet Relay Chat) for absolute beginners -- getting started

evilrixEngineering Manager
CERTIFIED EXPERT
An expert in cross-platform ANSI C/C++ development, specialising in meta-template programming and low latency scalable architecture design.
Published:

Introduction


This article is aimed at someone who has never used IRC before. It covers the very basics of setting up and configuring a client and a little bit about starting a channel and the basics of being a channel operator. What it doesn't do is review or promote any of the various IRC clients available. Nor does it cover power users; however, suitable reference material is suggested at the end for eager readers. Also note, there are many IRC clients available and all are different. The details given in this article are completely generic, providing commands that should operate on all IRC clients.

So, firstly, what is IRC and why would you want to use it? Well, put simply IRC is the daddy of the various Instant Messaging (IM) services we use today. It's been around for almost as long as The Internet. The main difference between IM and IRC is that IM is mainly focused on one to one conversations, like a telephone call, whereas IRC is mainly focused on group conversation, just like a meeting. The main benefit of IRC over IM is the fact it is collaborative. This makes it ideal for companies to implement as a communications medium for teams that may be located on different sites. Each team can join their own specific channel. If teams need to discuss sensitive information these channels can be password protected so no one else can join without being invited to do so.

With IRC you join a channel and when you do you are able to talk on that channel with everyone else who is on it. A channel is basically like a communal room, where people can pop in and have a chat. There are infinite channels; all you have to do is come up with any name you like as long as it starts with a '#' and join it. If it doesn't already exist, it will be created for you.

Unlike IM, you don't have to be invited to a channel to join in; anyone (with the correct password if it's key protected) can pop in. You can, if you wish, start a one to one conversation with another IRC user, but normally you join a channel first. It's also possible to send files to each other over IRC along with some other interesting client to client actions using a special protocol call DCC, but that will not be discussed here.

Getting started


So, how do you use IRC? Well, I'm glad you asked or this would be a very short article! To get started you need two things. First, you need an IRC server to connect too. The fact you are reading this article suggests you already have this. Second, you need an IRC client. There are plenty available for all Operating Systems so a good start would be to check Google. The right IRC client is a personal choice so I suggest trying a few before you settle on one.

So, assuming you now have your IRC client and are ready to connect to the server, let's begin. When you start your IRC client for the very first time there are a few things you'll need to configure.

Server/host: You will need to provide the IP address or the host name of your IRC server

Port: IRC Servers normally serve IRC from port 6667 and most clients will default to using this unless you change the setting. If your server uses a different port you will need to change the standard configuration of your client.

Ident: Ident is a protocol that allows a server you are connecting with to query your machine to find out your true identify. IRC servers often use this to confirm you are not trying to log in as a privileged user (such as root -- it's a Unix thing!) or as someone who doesn't have permission to use the server. This is mainly a historical option, rarely used anymore yet some IRC servers will refuse connection unless the service is available. Others will retry a number of times before letting you in anyway, but this can make the time to connect very slow. This being the case most IRC clients have the ability to act as an ident server. Generally, if your IRC client has an ident setting, just enter your normal username. Once this is set you can generally forget about it.

Username: Every IRC user needs a unique username. You can make up anything you want but, generally, the name can be no longer than 9 standard ASCII characters. If a username is already taken you will be told by your client to choose a different one before you can connect to the IRC server.

Those are the minimum settings you'll need to set to get connected. Other settings you might have will probably pertain to firewalls, such as SOCKS settings or client specific settings. These will not be discussed here as they are IRC client specfic.

So, get connected! On most GUI clients there is a button you click to connect. If not, use the /connect command to connect to the server.

/connect <server> [:port]

Piff... pufff. pooof... and if all has gone well you will be presented with connection details and then the MOTD!!!

Message of the day


Ok, so you configured your client and connected to your server. Now what? Well, the first thing you should do is read the Message Of the Day (MOTD). This will provide you all the details you need to know about using this server, including what is and isn't allowed and who to contact if there are any problems. In cast you missed the MOTD you can request it again using the /motd command.

/motd

Note that if you fail to comply with the restrictions of using the server your host will probably be k-lined. Basically, this is a setting an IRC Oper (and IRC Server Operator) to block your from connecting. IRC Oper's tend to be pretty touchy, think BOFH and you know where I am coming from!

Changing your 'nick'


Are you happy with your username, or 'nick' as it's known in IRC parlance? Well, if not you can change it using the /nick command.

/nick <username>

Let's change our username to 'expert'.

/nick expert

You should now see your name change. If not, it's probably because it's already in use and you'll get an error message telling you so. You'll have to choose something else. Remember, most IRC servers restrict usernames to 9 characters and only printable 7 bit ASCII values - this is because IRC was conceived back in the days when no other type of character set existed.

Note that when you change your username you are only changing the nickname that other users refer to you as, you are not changing your host or ident details so the server will still, for example, enforce any bans against you on a channel. The only way to change your host is to connect from a different hostname or ip address.

Private messaging


The main reason to use IRC is to collaborate on a channel but before we get onto that let me just show you how simple it is to start a private discussion with another user. To do this you just use the /msg command.

/msg <username> {message}

So, let's send our friend sue a hello greeting.

/msg sue Hello sue, I'm now online.

When you issue this command Sue will see your message (assuming she is online). It's up to the IRC client to decide how this message is delivered but nearly all GUI clients will open a new window that she can then type into to respond to you. Likewise, if you are using a GUI client your client will probably open a new window too for you to type into so that you and Sue can have a one-2-one chat. This chat is private (but not secure unless you are communicating over a secure protocol such as SSL) and cannot be seen by anyone else.

Joining a channel


Right, so MOTD read and we've said hi to Sue. Maybe we should think about joining a channel? There would be little use in using IRC if we didn't.

To join a channel we need to issue a client to server command. There are a number of basic commands you will need to learn when using IRC. Although most of these commands can be carried out via the GUI of your client, each client does it differently and it's far easier to remember the few simple commands. There aren't many so it's not that big of a deal. All IRC commands start with a forward slash '/'  and the one we're interested in right now is the '/join' command. The syntax is as follows:

/join <channel>{,<channel>} [<key>{,<key>}]

The channel parameter is the name of the channel you are going to join. All channels in IRC start with a hash (or pound as it's sometimes called -- I'm from the UK so it is definitely a hash!) '#'. You'll also see an optional password can be provided. This is for when a channel requires a password (or key) to join. Let's try and join a channel. For example, we might try and join the #ee channel.

/join #ee

Now, on execution of this command one of three things will happen:

1. The channel currently doesn't exist so you have just created it and become a channel operator (more on that in a bit)

If you are the first person to join the channel you will create the channel and become a channel operator. As a channel operator you are in control of the channel. This includes being able to set the channel topic, set a password to prevent unauthorised access, kicking out others who are being a nuisance and banning people who you no longer wish to have access to the channel. These various privileges will be discussed shortly.

2. The channel exists and you have joined it

If there are already people in this channel you join it as another normal user. Providing the channel hasn't be assigned special settings, such as users requiring a "voice", you will be able to chat to the other members.

3. The channel exists but it requires a password to join (mode +k, more on this shortly)

Unless you know the password, which you append to the end of the join command, you cannot join a password protected channel without an invite from a member already in that channel.

Channel and user modes


Channels and users can be assigned certainly privileges, modes. Below is the full list as specified by the IRC standard.

Assigning a channel mode

/mode <channel> {[+|-]|o|p|s|i|t|n|b|v} [<limit>] [<user>] [<ban mask>]

           o - give/take channel operator privileges;
           p - private channel flag;
           s - secret channel flag;
           i - invite-only channel flag;
           t - topic settable by channel operator only flag;
           n - no messages to channel from clients on the outside;
           m - moderated channel;
           l - set the user limit to channel;

               
Assigning a user mode

/mode <nickname> {[+|-]|i|w|s|o}

           i - marks a users as invisible;
           s - marks a user for receipt of server notices;
           w - user receives wallops;
           o - operator flag.

               
As you can see there are a plethora of modes that can be set for channels and users; however, only a few are really of interest to the beginner but you can find more information by looking at the technical specification, RFC1459, for IRC. Some of these will be covered in the rest of this article.

Channel operators


So, you connected to an IRC server, joined a channel and discovered you're the channel operator! Arrrrg! ok, don't panic. Breath, relax, let me guide you...

If you have become a channel operator (either because you started the channel or another user assigned you the privileges) there are a number of additional things you can do above and beyond a normal channel member. These will now be discussed briefly.

As discussed above, channels and users can be assigned 'modes'. These are single letter characters that assign properties to that user or channel. Users who are channel operators are added to the channel's mode 'o' list, which is a list of users for that channel who are operators. The operator flag is channel specific so being an operator on one channel does not automatically make you an operator on another channel. When you are a channel operator you are, basically, in control of the channel. There are a number of things a channel operator can do but what follows are the most basic and useful actions:

Op a user.

You can assign other trusted users the channel operator privileges. You do this using the mode command, applying a +o flag to the channel for their username. So, let's say the user jack is someone we trust. let's op him on channel #ee.

/mode #ee +o jack

Most IRC clients implement a shortcut to this in the form of the /op command.

/op <nick> [channel]

Deop a user.

You can also deop someone by removing the o flag.

/mode #ee -o jack

Notice how we use a + prefix to add a flag and a - prefix to remove a flag?

Most IRC clients implement a shortcut to this in the form of the /deop command.

/deop <nick> [channel]

Kick a user.

If a user is disrupting the channel you can kick them out using the /kick command.

/kick <username>

Ban a user.

To ban a user you add a mask for their host to the channels ban list. Users are banned by mask to prevent them from trying to rejoin by just changing their username. The idea is you take their IRC host string and use wildcards to build a mask. You can get their host name by using the /whois command.

/whois <username>

You set a ban using the mode command, applying a +b flag to the channel for their host mask. So, let's say the user lamer is logged in from IRC client someclient@somedomain.com their full host name would be lamer!someclient@somedomain.com. So, a suitable host mask would be something like *!*@somedomain.com. So, let's ban them from channel #ee.

/mode #ee +b *!*@somedomain.com [reason]

Most IRC clients implement a shortcut to this in the form of the /ban command.

/ban <username> [channel] [reason]

If that command is run on the channel the user will normally be kicked and banned.

Losing your voice

Channels can be moderated so only users with a 'voice' can speak. Users that do not have this flag are unable to send messages to the channel. To set the channel as moderated we need to add the +m flag to the channels list of flags.

/mode <channel> +m

Again, you can remove this flag using the same command but with a '-' rather than a '+'.

To give the user a voice assign them a +v flag for that channel.

/mode <username> +v [channel]

Set a channel password

You may wish to restrict access to your channel. You can do this by assigning a password (or key as it's actually known). We do this by assigning a +k flag to the channel. Let's password protect #ee with the password "askme".

/mode #ee +k askme

It's a security risk though right?


IRC has a pretty bad reputation for being an insecure protocol and to some extent this is justified. However, this is like blaming a hammer for hitting your thumb. Ultimately, as long as you are sensible and follow common sense when using IRC you are no less secure than, for example, using IM or e-mail. So, never accept any files being sent to you over IRC unless they are being sent from a trusted source and you have previously agreed to receive them. Always make sure you are running an up-to-date anti-virus product and always ALWAYS scan any files before opening them.

Even this won't guarantee you won't fall victim to malware so if possible just never accept files! Ensure you have a reputable firewall set up. Don't just rely on your router's hardware firewall. This will protect you from any external nasties but if just one of your machines gets infected with a worm it'll travel around your internal network in seconds, infecting all your machines! Never give out your personal or private details to anyone over IRC, including credit card details. As mentioned before, IRC is not a secure protocol and everything is sent in plain text. Anyone Packet Sniffing your network may see everything you type and send to the server.

Further Reading


That pretty much sums up all the basic information and commands you need to use IRC. There is plenty more to learn though so I recommend taking a look at the following references.

http://irchelp.org/irchelp/irctutorial.html
http://irchelp.org/irchelp/misc/ccosmos.html
http://irchelp.org/irchelp/changuide.html
http://tools.ietf.org/html/rfc1459

The guides look big and scary, but do not fear as the info you've learnt from reading this article will provide you all you need to know to successfully use IRC, the other stuff is for 'power users'.

Good luck and happy IRCing.
7
10,529 Views
evilrixEngineering Manager
CERTIFIED EXPERT
An expert in cross-platform ANSI C/C++ development, specialising in meta-template programming and low latency scalable architecture design.

Comments (3)

tigermattStaff Platform Engineer
CERTIFIED EXPERT
Most Valuable Expert 2011

Commented:
Nice article. Thanks Rx!

-Matt
evilrixEngineering Manager
CERTIFIED EXPERT

Author

Commented:
Thanks Matt.
CERTIFIED EXPERT
Most Valuable Expert 2012

Commented:
Voted yes.

Have a question about something in this article? You can receive help directly from the article author. Sign up for a free trial to get started.