Using WeeChat for Internet Relay Chat

Traducciones al Español
Estamos traduciendo nuestros guías y tutoriales al Español. Es posible que usted esté viendo una traducción generada automáticamente. Estamos trabajando con traductores profesionales para verificar las traducciones de nuestro sitio web. Este proyecto es un trabajo en curso.
Create a Linode account to try this guide with a $100 credit.
This credit will be applied to any valid services used during your first 60 days.

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 Linode instance, or any computer running a supported platform. If you run WeeChat on your Linode, 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 Setting Up and Securing a Compute Instance.

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 Linode customers use IRC to get technical help and exchange knowledge.

The official Linode channel is #linode on the OFTC network (irc.oftc.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. If you have not already done so, create a Linode account and Compute Instance. See our Getting Started with Linode and Creating a Compute Instance guides.

  2. Follow our Setting Up and Securing a Compute Instance guide to update your system. You may also wish to set the timezone, configure your hostname, create a limited user account, and harden SSH access.

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, you can check our Users and Groups guide.

Using GNU Screen

GNU Screen allows you to start WeeChat and leave it running, even if you disconnect from your Linode. We recommend running WeeChat in Screen, so our instructions include Screen-specific commands. For more information, see Using GNU Screen to Manage Persistent Terminal Sessions.

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 OFTC network), you will use the /server command.

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

This adds a server named “oftc” with hostname “irc.oftc.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 oftc

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

To disconnect, run:

/disconnect oftc

Joining and Parting Channels

To join a channel, run:

/join channel

For example, /join #linode.

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 #linode.

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 #linode will switch to the #linode 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 Linode?” to someone with the nickname friend, run:

/msg friend Have you heard about Linode?

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.

CommandDescription
/helpLists commands, if a command is given then shows command usage and description
/joinJoins a channel
/closeCloses a buffer, parting the channel if you are in it
/quitQuit WeeChat
/msgSend a message to a nick (or channel)
/queryOpens a private buffer with a nick
/banBan a user from a channel
/unbanUnban a user from a channel
/kickKick a user from a channel
/kickbanKick and ban a user from a channel
/partParts a channel but does not close the buffers
/topicSets channel topic
/whoisShows 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 oftc. This setting should be a comma separated list of channels to join. For example, if I want to join #linode when I connect to the oftc network, I would run:

/set irc.server.oftc.autojoin "#linode"

Then, whenever I connect to the oftc server, I will automatically join #linode.

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 Linode instance and connected later.

More Information

You may wish to consult the following resources for additional information on this topic. While these are provided in the hope that they will be useful, please note that we cannot vouch for the accuracy or timeliness of externally hosted materials.

This page was originally published on


Your Feedback Is Important

Let us know if this guide made it easy to get the answer you needed.


Join the conversation.
Read other comments or post your own below. Comments must be respectful, constructive, and relevant to the topic of the guide. Do not post external links or advertisements. Before posting, consider if your comment would be better addressed by contacting our Support team or asking on our Community Site.