IRC from Linux

IRC from Linux

figs/beginner.gif figs/hack2.gif

XChat is a popular IRC client with a graphical user interface. You can download the source code or precompiled binaries for a variety of platforms.

XChat can be downloaded from, either as source code or in the form of precompiled binaries or packages. If you have a packaging system such as apt or Gentoo's emerge, then you may be able to get away with apt-get xchat or emerge xchat.

1 Nicknames, Usernames, and Real Names

When you first run XChat, you will be presented with a Server List dialog box. The first task is to go down to the bottom and select Edit Mode. From there, you can see all your server settings. Next examine the top area marked Global User Info. The top three boxes are for your nickname. Most of the time, you will connect with your first listed nickname; however, if that name is already in use by another user, it will try again with the second and then with the third. You shouldn't make these the same, but they can be close variants, for example:

Bob, Bob_, Bobby

Foo, FooBar, Foo_Bar

CoolDude, Cool_Dude, Kewld00d

Your username is used internally by the server to form your host mask, although some servers will try to use an Ident call [Hack #80] to look up your username instead. Your chosen username will be used if the Ident call fails. You can use your nickname, an alternate nickname, or just about anything you want here—although it may be truncated and must not contain any special characters. Your real name can also be anything you want, but it can be longer and can include spaces. As an example, your IRC nickname might be "Han" with username "solo" and real name "Harrison Ford." Be as creative as you like.

2 Server Configuration

The next step is to configure your servers. XChat comes with a lot of servers listed, and it may already have the one you want; if not, you can click Add above the list of servers to create a new one. This will create a New Network. To rename this network to something more informative, slowly click it twice (don't double-click, as that will make XChat connect to the server). Once you've done this, you should look at the list of Servers on the far right. This is a list of servers; each server is of the form server/port. Your network will be set with newserver/6667 and, unless you've explicitly set one up on your local network, chances are there is no server called "newserver." So instead, click on this, and replace it with the address and port of the server you want. If you leave off the /port portion, the default port number of 6667 will be used. Most IRC servers will let you connect to this port, and many will even have alternative ports as well. Here are some example servers:

Finally, if you know what channels you want to connect to, place them in the Join Channels box. Use commas to specify more than one channel, for example:


You are now ready to connect to an IRC server. Click the Connect button and wait until you are connected. If you'd like to connect to another server as well, return to the list with Ctrl-S, or use the menu: XChatServer List. Select the new server from the list, but this time use Connect in a New Tab to create a separate tab for this new server. If you forget to do this, you will disconnect from your current server and connect to the new one in the existing tab.

3 Advanced Options and Autoconnects

If you use IRC only occasionally, you probably won't mind picking your favorite network from the list every time you start XChat. But if you connect to several IRC servers regularly, you'll probably want to connect to all of them automatically. To do this, select the network from your server list and check Auto Connect at Startup. If you do this, you may also want to check the No Server List at Startup option.

4 Setting Up Autologin

If you're on a standard IRC network, you can usually set yourself up to automatically log in by specifying a Connect command in the server details screen. For example:

msg nickserv identify password

Notice that this command does not begin with a / character. If you'd like to use more than one command here, you need to set up a user command (as described later) with multiple entries and type its name here instead.

5 Selecting a Stable Server

Most IRC networks are made up of more than one server; many will list these at the network's web site. In most cases, you will connect to a round-robin server, which will automatically pick a server and direct you there. Generally, you won't need to change this, but you may sometimes want to connect to a specific server. If you find a particular server that behaves more stably that any of the others, you can set the server of your choice at the top of the server list for your network. You can then click the Add button to add another one in case your preferred one is down. For example:,,

6 Different Nicknames on Different Networks

If you want to use a different nickname on a certain network, select the network in the server list and uncheck Use Global User Info. You can then fill in a nickname, username, and real name for this server.

7 Setting Up the User Interface

The XChat interface can be customized in a number of ways. The first few are simple visibility options. Right-click a blank area in the IRC window, and you can select on and off options for the menu bar, topic bar, mode buttons, and user list buttons. Select whatever combination makes you happy. The next set is available from the menu bar or the right-click menu, SettingsPreferences. There are far too many preferences to detail here, so you may like to play around with them and see what you can achieve. Here are some items worth noting:

7.1 Interface/Text Box

Besides setting the colors and fonts for chatting, the checkboxes also affect the way you see your chat. Try turning on Nick Coloring or Timestamp, for example, or perhaps you prefer to turn off the Indented Nicknames feature?

Input Box

The Nick Completion Suffix is used for two things. First, if you type a partial nickname at the start of the line and press the Tab key, XChat will attempt to complete the nickname and add this suffix to it. Second, if you check Automatic Nick Completion, whenever you type a partial nickname followed by this suffix, XChat will replace it with the full nickname.

User List

The Lag Meter and Throttle don't take up much room and are informative; it is a good idea to set this to Both. Here you can also change the user list sort order or set a double-click command.


Tabs are used to store channel and server windows. This lets you adjust the layout of your screen and how you use tabs.


These settings let you change the colors of your text box and user list.

7.2 Chatting/General

Here you can set the default messages for when you quit IRC, leave a channel, or go away. You can add words that will trigger the highlight/beep feature. Also, if you don't like the way XChat announces your away messages, you can uncheck that here.

7.3 Logging

If you wish to log conversations (for reference or for generating IRC statistics), you can check Enable Logging of Conversations here. You shouldn't change the other options unless you know what you're doing, especially if you want to use a third-party program to generate statistics.

7.4 Network/Setup

Most users won't need to make any changes to the settings here, but there are some useful options for file transfers. This lets you change where XChat places incoming files or adjust the speed at which the files are transferred. If you are behind a firewall, you can also restrict the DCC ports used when you send files.

8 Hacking XChat

Here are some neat hacks you can do with XChat:

8.1 Tab in a window

If you want to remove a tab and give it its own window, press Ctrl-I. Press them again to place it back as a tab. You can also right-click on the tab and select Detach Tab. If you'd like to change the default behavior of windows and tabs, see the Preferences dialog box under the Tabs section.

8.2 Per-channel options

Right-click on a tab, and choose the Channel Name submenu. You can turn off join/part messages for the busy channels, set the channel to beep on activity for the important but quiet channels, or allow color pasting in the channel.

8.3 All-server commands

If you'd like to set up a command to go to all your servers or all your channels, type /allserv command or /allchan command. For example:

/allserv away down south in Dixie

This will set your status to Away (and your away message to "down south in Dixie") for all of the servers you are connected to.

8.4 Use colors

Many people recommend that you don't use colors. They're more often abused than used effectively. Many consider them to be garish and ugly. Furthermore, they're not IRC standards, they're not supported by all clients, and you can't even tell whether another person's IRC client has a white background or a black one. However, if you find you simply must use color codes:


Typing this as part of a message will cause it to be interpreted as a color code. The ## must be replaced with a two-digit number (see SettingsPreferences Colors for the list).


This will make a message bold.


This will underline your message.


This will set your output back to normal, using the default color.

Alternatively, you can right-click the channel tab and select Insert mIRC Color Code.

8.5 Display output with /exec

Under Unix and Linux systems, you can display output from any command that you run. For example:

/exec uptime

This will execute the uptime command and show your system's uptime and load averages. This, however, is displayed in the window and not sent to the IRC server. If you want to brag about your system's uptime, though, you can do this:

/exec -o uptime

The output will now be sent to the IRC channel you're currently active in.

You can also call commands that do not immediately exit. For instance:

/exec -o tail -f  /var/log/httpd/access_log 

This will print the accesses to your web server as they occur, if you really need to. You can even send input to the command with /execwrite, stop it with /execstop, resume with /execcont, and kill it with /execkill.

Be careful what programs you call. /exec -o yes or /exec -o cat /dev/urandom, especially in a DCC chat, will probably crash XChat, and they are generally considered silly things to try. Having heard that, you'll probably want to try it just to see what happens.

8.6 Setting up auto-replace strings

An auto-replace is a string of text that gets automatically replaced with another. For example, XChat will automatically replace "teh" with "the" as you type it. To review or change this behavior or add new auto-replace options, go to SettingsListsAuto-replace. To add a new option, click the New button and then edit the New and EDIT ME regions. For example:

billy => Over and Under General War Commander Sergeant Billy Goat-Legs

Now, whenever you type in billy followed by a space or Enter, you'll see his full title appear.

8.7 Setting up user commands

Setting up a user command in XChat is simple. First, go to SettingsListsUser Commands. Click Add New, and choose a name. Then you can type in your command. You can click the Help button for a list of substitution strings. Here's an example:

whine => me whines, complains, and makes a nuisance of himself.

Now, go to your least-favorite channel and type /whine. You'll be making yourself feel unwelcome in no time.

You can also give your commands arguments:

greet => me greets %2 in the manner of the Courts of Chaos.

You can now stab your friends in the back—erm—greet your friends with a flourish, with a simple command, like /greet Corwin or /greet JackBauer.

If you want the rest of your string to be used as an argument instead of just one word per argument, you use the & character:

hero => say &2 is my hero!

Now, with a simple /hero Linus Torvalds, you can cast your vote in support of free software!

Commands can be multiple action as well. They will be performed in the order listed, for example:

rofl => me is on the floor

rofl => me is rolling around...

rofl => me is laughing!!!

You can call external commands with the /exec command detailed earlier. For example, to counter those annoying mIRC "sysinfo" scripts, you could try this:

sysinfo => exec -o uname -a && uptime &&df -h | egrep "(hda1|hda3|hda5)"

If you have other system information scripts, you can call them instead of, or in addition to, the ones found here.

It is inadvisable to call exec multiple times in a row, because XChat can be running only one process per text box at any time.

8.8 Customize messages/colors and set sounds

You can change the message format and colors of any event in IRC or assign a custom sound to play. First, go to the SettingsListsEvents menu. Then find the event you want to change.

For example, to have a sound play whenever the topic changes, you would select Topic Change and enter a path to a sound file.

If you want your messages to be surrounded with, say, yellow square brackets ([]) instead of purple pointy brackets (<>), select Your Message and enter:


The arguments to each message ($1, $2, etc.) are listed below the message as you select them. $t refers to the tabbed line, if you have Indented Nicknames on. %C, %B, and %O are color codes, as described earlier.

One often-requested format change is to display an @ in front of operators and a + in front of voiced users. To do this, modify the Channel Message format string like so:


$3 will display an @, +, or nothing, as appropriate.

8.9 Add user list buttons and menu commands

Assuming you have the user list buttons turned on (right-click empty space, then select User List Buttons), you can add buttons to this list or to the user list pop up (which appears when you right-click a username in the chat window or the user list). The syntax for such a command is the same as for a user command, except the name of the command is used for the label of the button or the menu item, and there are more substitutions available. Use existing entries as guidelines if you want to.

Add CTCP replies

Care to set up some useful information for CTCP? Want to mess up people who PING and VERSION you? Using SettingsListsCTCP replies, you can set it up to do anything when someone sends you a CTCP message. In general, use the same guidelines as the other lists (and see Help for useful substitutions). Note, however, that the proper way to send a reply is:

nctcp %s (query) (result)

So a sample reply to a TIME request would be:

nctcp %s TIME Sat Nov 12 22:04:00 1955

This will ensure maximum compatibility with other clients.

Thomas Whaples

     Python   SQL   Java   php   Perl 
     game development   web development   internet   *nix   graphics   hardware 
     telecommunications   C++ 
     Flash   Active Directory   Windows