IRC Primer

Internet Relay Chat (IRC) is an open protocol that uses TCP and optionally TLS. IRC was born in August 1988, by Jarkko Oikarinen at the University of Oulu in Finland. Years later, in 1993, was standardised as RFC 1459. Assigned port 194/TCP by IANA, however in practice most use 6667/TCP, and nearby ports (6660-6669, 7000).

Each client session is assigned a unique identifier called a hostmask, which takes the form nick!user@host. Some networks (such as freenode) offer cloaks to show affiliation with a project, by altering the hostmask. For example alex@ could become They’re basically a badge of pride and legimaticy of who you say you are.

  1. Install a client (e.g. weechat).
  2. Register a server (e.g. freenode) /server add freenode -ssl -autoconnect or /server add oftc -ssl -autoconnect
  3. Set your nick /nick snazzybeard
  4. Register nick with NickServ /msg NickServ REGISTER password
  5. You’ll receive an email from NickServ, with a one off verification code.
  6. Verify with NickServ /msg NickServ VERIFY REGISTER vimjock abcdefg
  7. Group other nicks you want to the same account. /nick myothercoolnick then /msg NickServ IDENTIFY vimjock password then /msg NickServ GROUP
  8. In the future, once registered, you can login with the IDENTIFY command /msg NickServ IDENTIFY vimjock password
  9. Join a channel /join ##C or /join #cjeopardy


The means of communicating with a group of users. Basic channel operations include joining /join #channel, leaving /part #channel, and listing /list. Channel prefixes encode the following meanings:

  • # channel that is available across the entire IRC net
  • ## or more hashes, indicates its off topic
  • & channel local to a server
  • + modeless
  • ! timestamped channel

The most effective way to find a channel is by asking alis. Alis supports these options:

  • min <n>: show only channels with at least users
  • max <n>: show only channels with at most users
  • skip <n>: skip first matches
  • show [m][t]: show modes/topicsetter
  • mode <+|-|=><modes>: modes set/unset/equal
  • topic <pattern>: topic matches pattern
  • showsecret: show secret channels (requires chan:auspex)


/msg alis LIST searchterm
/msg alis LIST * -topic multiple*ordered*search*terms
/msg alis LIST * -min 50
/msg alis LIST #foo*
/msg alis LIST #foo* -mode =n
/msg alis LIST *freetopic* -mode -t -show mt
/msg alis LIST ##nocolors* -mode +c -show t

ChanServ is the bot responsible for channel management, and doesn’t mind when you ask for help /msg ChanServ help:

***** ChanServ Help *****
ChanServ gives normal users the ability to maintain control
of a channel, without the need of a bot. Channel takeovers are
virtually impossible when a channel is registered with ChanServ.
Registration is a quick and painless process. Once registered,
the founder can maintain complete and total control over the channel.
Please note that channels will expire if there are no eligible channel successors.
For more information on a command, type:
/msg ChanServ help <command>
For a verbose listing of all commands, type:
/msg ChanServ help commands

The following commands are available:
FLAGS           Manipulates specific permissions on a channel.
INVITE          Invites you to a channel.
OP              Gives channel ops to a user.
RECOVER         Regain control of your channel.
REGISTER        Registers a channel.
SET             Sets various control flags.
UNBAN           Unbans you on a channel.


Channel Modes

Mode Name Description
b channel ban +b nick!user@host (wildcards * and ? supported)
c colour filter Strip colour and formatting codes from channel messages.
C block CTCPs Blocks client-to-client protocol commands.
e ban exemption Overrides +b and +q bans. Example: /mode #channel +bee *!*@* *!* $a:JohnDoe would block all users from, while still allowing someuser from host3 and JohnDoe to join.
f forward Users who cannot join the channel (because of +i, +j, +r, see below) are instead sent to the given channel.
F enable forwarding Allow operators in other channels to forward clients to this channel, without requiring ops.
g free invite Anybody in the channel may invite others.
i invite only Users are unable to join invite-only channels unless they are invited or match a +I entry.
I invite exemption Takes a ban parameter.
j join throttle Takes one parameter of the form n:t. Only n users may join in each period of t seconds, so with e.g. 3:10 only 3 users could join within 10 seconds. Invited users can join regardless of +j, but are counted as normal. You can use this mode to prevent bot attacks. This mode can be combined with +f to forward throttled users to an overflow channel.
k password To enter the channel, you must specify the password on your /join command.
l join limit Limits the number of users who can be in the channel at the same time.
m moderated Only opped and voiced users can send to the channel.
n prevent external send Users outside the channel may not send messages to it. Keep in mind that bans and quiets will not apply to external users.
p private The KNOCK command cannot be used on the channel, and users will not be shown the channel in whois output unless they share the channel with the requestor. The channel will still appear in channel lists and WHO output (set channel mode +s if this is not desired).
q quiet Works like +b (ban user), but allows matching users to join the channel.
Q block forwarded users Users cannot be forwarded (see +f above) to a channel with +Q.
r block unidentified Prevents users who are not identified to services from joining the channel.
s secret This channel will not appear on channel lists or WHO or WHOIS output unless you are on it.
S SSL-only Only users connected via SSL may join the channel while this mode is set. Users already in the channel are not affected. Keep in mind that this also blocks all webchat users, as they are not marked as connected via SSL.
t ops topic Only channel operators may set the channel topic.
z reduced moderation The effects of +b, +q, and +m are relaxed. For each message, if that message would normally be blocked by one of these modes, it is instead sent to channel operators (+o).

Channel Flags

FLAGS are how channel privileges are granted and removed, /msg ChanServ help flags:

***** ChanServ Help *****
Help for FLAGS:

The FLAGS command allows for the granting/removal of channel
privileges on a more specific, non-generalized level. It
supports nicknames, groups and hostmasks as targets.

When only the channel argument is given, a listing of
permissions granted to users will be displayed.

Syntax: FLAGS <#channel>

Otherwise, an access entry is modified. A modification may be
specified by a template name (changes the access to the
template) or a flags change (starts with + or -). See the
TEMPLATE help entry for more information about templates.

Syntax: FLAGS <#channel> [nickname|hostmask|group template]
Syntax: FLAGS <#channel> [nickname|hostmask|group flag_changes]

    +v - Enables use of the voice/devoice commands.
    +V - Enables automatic voice.
    +o - Enables use of the op/deop commands.
    +O - Enables automatic op.
    +s - Enables use of the set command.
    +i - Enables use of the invite and getkey commands.
    +r - Enables use of the unban command.
    +R - Enables use of the recover, sync and clear commands.
    +f - Enables modification of channel access lists.
    +t - Enables use of the topic and topicappend commands.
    +A - Enables viewing of channel access lists.
    +S - Marks the user as a successor.
    +F - Grants full founder access.
    +b - Enables automatic kickban.
    +e - Exempts from +b and enables unbanning self.

The special permission +* adds all permissions except +b, +S, and +F.
The special permission -* removes all permissions including +b and +F.

    /msg ChanServ FLAGS #foo
    /msg ChanServ FLAGS #foo foo!* VOP
    /msg ChanServ FLAGS #foo foo!* -V+oO
    /msg ChanServ FLAGS #foo foo!* -*
    /msg ChanServ FLAGS #foo foo +oOtsi
    /msg ChanServ FLAGS #foo TroubleUser!*@* +b
    /msg ChanServ FLAGS #foo !baz +*

Buffer Management

On the client is how a channel, private message, or service notification, is presented. As you will typically have multple of these at once, some useful commands to juggle them:

/win # /buf # alt + # /b name will match a buffer by partial name /join #channel /window move

WeeChat key bindings:

F5/F6 switch to previous/next buffer F7/F8 swtich to previous/next window F9/F10 scroll title bar F11/F12 scroll nicklist


/window splith split horizontal /window splitv split vertical /window zoom zoom current window /window merge

Buffers can be merged. For example you might want particular messages to go to a specific buffer.


WeeChat ships with the logger plugin. By default buffers are logged to ~/.weechat/logs, very handy for scanning for historic conversations and topics.

The /logger command will dump out current logs, example output:

Logging on buffers:
  [1] (core) weechat: logging (level: 9) (/home/ben/.weechat/logs/core.weechat.weechatlog)
  [1] (irc) server.freenode: logging (level: 9) (/home/ben/.weechat/logs/irc.server.freenode.weechatlog)
  [2] (irc) freenode.##C: logging (level: 9) (/home/ben/.weechat/logs/irc.freenode.##c.weechatlog)
  [3] (irc) freenode.#cjeopardy: logging (level: 9) (/home/ben/.weechat/logs/irc.freenode.#cjeopardy.weechatlog)

Set one directory by IRC server and a file by channel inside

/set logger.mask.irc irc/$server/$channel.weechatlog

Will make the following tree:

    |- logs/
        |- irc/
            |--- freenode/
            |       freenode.weechatlog
            |       #weechat.weechatlog
            |       #mychan.weechatlog
            |--- oftc/
            |       oftc.weechatlog
            |       #chan1.weechatlog
            |       #chan2.weechatlog

Log all messages on IRC buffers but not join/part/quit messages

For all IRC buffers:

/set logger.level.irc 3

For a server and its channels:

/set logger.level.irc.freenode 3

For a specific channel:

/set logger.level.irc.freenode.#weechat 3

Useful Features



ctrl+n, ctrl+p vs alt+n, alt+p

For quickly cycling buffers.

usermode +g == callerid


moving windows

/window move # or /buffer move #

  • autolog
  • searching ^r to search, and enter to stop

Peace and Quiet

/ignore a client side filter (e.g. user@host) /silence a server side filter which given a regex, will prevent spamming of the client. /mode <username> +g (callerid)

smartfilter or /filter to filter out pollution

With smart filter (keep join/part/quit from users who spoke recently):

/set irc.look.smart_filter on
/filter add irc_smart * irc_smart_filter *

With a global filter (hide all join/part/quit):

/filter add joinquit * irc_join,irc_part,irc_quit *

For more help /help filter and /help irc.look.smart_filter


/connect -ssl run over SSL (usually port 6697, versus cleartext on 6667). sasl ( if disconnected, do the nickserv tango, put on any cloaks, before auto re-adding to channels.