Using WeeChat for Internet Relay Chat

WeeChat is a multi-platform, terminal-based Internet Relay Chat (IRC) client written in C. Weechat is intended to be flexible and extensible, and thus has all sorts of plugins written in different languages including Python, Perl, and Ruby.

Many users prefer WeeChat over other graphical and terminal-based clients because of its many features and its customizability. One advantage of terminal-based clients over graphical IRC clients is the ability to detach from your WeeChat instance and come back later, locally or remotely, using a terminal multiplexer such as Screen or tmux.

WeeChat is usually run in a terminal emulator. It may be run either on your computer, a SiSrv instance, or any computer running a supported platform. If you run WeeChat on your SiSrv, you can access WeeChat at any time from any system simply by connecting via SSH and attaching to your Screen or tmux instance. This guide assumes you have read Using The Terminal and Linux System Administration Basics, along with the Getting Started Guide.

What is IRC?

Internet Relay Chat (IRC) is a protocol that is used to create IRC “networks,” sets of IRC servers that can be connected to using IRC clients. Networks are usually independent. Inside a network, there are many channels which can be joined by users. Usually anybody can create a channel. Channels are usually prefixed with hash signs (#), and sometimes contain multiple hash signs to represent different types of channels. Individual users can also chat with each other privately using private messages. Many SiSrv customers use IRC to get technical help and exchange knowledge.

The official SiSrv channel is #sisrv on the SiSrv network (irc.sisrv.net).

On IRC, users are classified by four characteristics:

  • Nickname, a unique user-chosen string which is shown as their handle.
  • Username, a separate string from the nickname which is provided by the user. Does not have to be unique.
  • Host, the IP or hostname from which a user is connecting.
  • Real Name, an optional argument containing your name (spaces are allowed)

A user is often represented as nickname!username@host.

Before You Begin

  1. This guide will use sudo wherever possible. Complete the sections of our Securing Your Server to create a standard user account, harden SSH access and remove unnecessary network services. Also follow the section to create a firewall, but omit the lines for ports 80 and 443 as these are not needed for a WeeChat server.
  2. Update your system:

    CentOS

     
    sudo yum update
    

    Debian / Ubuntu

     
    sudo apt-get update && sudo apt-get upgrade
    
Note
This guide is written for a non-root user. Commands that require elevated privileges are prefixed with sudo. If you’re not familiar with the sudo command.

Using GNU Screen

GNU Screen allows you to start WeeChat and leave it running, even if you disconnect from your SiSrv. We recommend running WeeChat in Screen, so our instructions include Screen-specific commands.

Installing WeeChat

Below are instructions for installing WeeChat and Screen on different Linux distributions and operating systems.

Arch Linux

 
sudo pacman -S weechat screen

CentOS

 
sudo yum install weechat screen

Debian / Ubuntu

\WeeChat provides repositories for various Debian and Ubuntu releases. See their downloads page for the repo addresses. The repo address for your version should look similar to https://weechat.org/distribution version sid main. Debian and Ubuntu both include Screen by default.

Using the address you found above, create a file so that your system knows where to check for the correct version of WeeChat, substituting the actual repo address for address:

 
echo "address" | sudo tee /etc/apt/sources.list.d/weechat.list

You are now ready to install WeeChat:

 
sudo apt-get install weechat

Fedora

 
sudo dnf install weechat screen

Mac OS X (HomeBrew)

 
brew update
brew install screen
brew install weechat

Mac OS X (MacPorts)

 
port install screen
port install weechat

Windows (Cygwin)

  1. Install Cygwin. Ensure that subversion and wget are marked to be included during the installation process

  2. Install apt-cyg with the following commands

     
    svn --force export http://apt-cyg.googlecode.com/svn/trunk/ /bin/
    chmod +x /bin/apt-cyg
    
  3. Install WeeChat using the apt-cyg package

     
    apt-cyg install weechat
    

Running WeeChat

To start WeeChat in a screen on most systems (including Debian 7), run:

 
screen weechat-curses

You should now see the WeeChat chat window. If you don’t, try running screen weechat instead of screen weechat-curses.

When you first launch WeeChat, it automatically creates a configuration file in ~/.weechat.

Using WeeChat

Adding and Connecting to a Server

To add a server (in this case the SiSrv network), you will use the /server command.

 
/server add sisrv irc.sisrv.net/6697 -ssl -autoconnect

This adds a server named “sisrv” with hostname “irc.sisrv.net” connecting on port 6697. WeeChat will connect using SSL and will automatically connect when you start WeeChat. Once you define the server, you can run:

 
/connect sisrv

This will tell WeeChat to connect to the server you just set up.

To disconnect, run:

 
/disconnect sisrv

Joining and Parting Channels

To join a channel, run:

 
/join channel

For example, /join #sisrv

Make sure to run join/part commands in the proper server window. You can use ALT+X to switch server windows.

To part, or leave, a channel, run:

 
/part channel

For example, /part #sisrv

Switching Channels/Buffers

If you have mouse support enabled and also have installed buffers.pl (see the WeeChat Commands section below), then you can simply click on buffers you have joined then type messages in the bottom bar. Pressing Enter will submit your message.

Otherwise, you can use /buffer to switch between buffers by number or name. For example, /buffer 1 will switch to buffer 1, while /buffer #sisrv will switch to the #sisrv buffer. You can also press ALT+number (ESC+number on a Mac), where “number” is 1-9, to switch to that buffer number. ALT+4 (ESC+4 on a Mac) will switch to buffer 4.

Sending Private Messages

To send a private message to a nickname, run:

 
/msg nick message

For example, to send the message “Have you heard about SiSrv?” to someone with the nickname friend, run:

 
/msg friend Have you heard about SiSrv?

You can also open a buffer for a nickname with /query. This will create a new buffer which you can send and receive messages in to and from a user. For example, /query friend will open a conversation with “friend”.

Changing your Nickname

To change your nickname after you have connected, run:

 
/nick newnickname

Note that this will only work if the new nickname is not already in use.

Quitting WeeChat

To quit WeeChat completely, run:

 
/quit

Configuring WeeChat

You usually will not have to directly edit any WeeChat configuration files. Most configuration is done through WeeChat commands.

Installing Plugins

WeeChat has a plugins system which allows you to install different modifications to WeeChat for different use-cases and user preference. In WeeChat versions 0.3.9 and above, a script management system is included. /script will open up a list of available and installed scripts. From there, you can follow the instructions to install scripts interactively, or install a script using /script install followed by the script name.

WeeChat Commands

All WeeChat commands begin with a /. Every channel in WeeChat is a buffer. Servers are also buffers. By default, WeeChat does not include a list of buffers, but you may install a plugin that does. The buffers.pl plugin is recommended and displays a list of buffers on the left of the screen. This allows you to see what channels and servers you are in without having to remember special commands.

 
/script install buffers.pl

/mouse enable will enable mouse support, which allows you to scroll as well as click buffers to change channels and servers.

A list of basic commands is below.

Command Description
/help Lists commands, if a command is given then shows command usage and description
/join Joins a channel
/close Closes a buffer, parting the channel if you are in it
/quit Quit WeeChat
/msg Send a message to a nick (or channel)
/query Opens a private buffer with a nick
/ban Ban a user from a channel
/unban Unban a user from a channel
/kick Kick a user from a channel
/kickban Kick and ban a user from a channel
/part Parts a channel but does not close the buffers
/topic Sets channel topic
/whois Shows information about a user

Setting Default Channels

WeeChat uses the /set command to manipulate WeeChat settings. It allows you to change many different attributes about WeeChat, including appearance and functionality.

You can tell WeeChat to automatically connect to some channels when it connects to a server using the irc.server.name.autojoin setting substituting the server to which you are connected for name. In the above configuration, we connected to SISrv. This setting should be a comma separated list of channels to join. For example, if I want to join #sisrv when I connect to the SiSrv network, I would run:

 
/set irc.server.sisrv.autojoin "#sisrv"

Then, whenever I connect to the SiSrv server, I will automatically join #sisrv

Setting Default Nickname, Username, and Real Name

Setting the default nickname, username, and real name is just as simple. To set your default nickname, run:

 
/set irc.server_default.nicks "nickname"

You can also specify backup nicknames in case the one you want is taken when you connect.

 
/set irc.server_default.nicks "nickname,othernickname"

Setting the default username:

 
/set irc.server_default.username "username"

Setting the default real name:

 
/set irc.server_default.realname "realname"

Accessing your WeeChat instance

If you ran WeeChat in a screen as specified above, you have the ability to detach from your WeeChat instance and to reattach later. To detach from the screen, press CTRL+A, then D. To reattach to your screen, run screen -r. You can reattach to your screen even if you have logged out from your SiSrv instance and connected later.

  • Weechat
  • 17 Users Found This Useful
Was this answer helpful?

Related Articles

How to Set Up a Mac for Your Kids

Providing children with access to a computer and the internet is increasingly important, but so...

How to Get Help With a Command from the Linux Terminal

Whether you’re an inexperienced terminal user or a grizzled veteran, you won’t always know the...

How to change the ssh port on Linux

To Change the SSH Port for Linux Server Connect to your server via SSH Switch to the root...

How To Install screenFetch in Linux

If you've browsed Linux groups on social media, you've probably seen a lot of screenshots that...

Static IP vs. Dynamic IP Address

A static IP address is one that remains fixed and never changes. The PC always sees the same...

Powered by WHMCompleteSolution