Debian

How to Install and Use WeeChat on Debian 10

Most of us are familiar with messaging tools such as Facebook, Twitter, WhatsApp, and other fringe ones like Signal. However, most of us don’t know that it’s possible to combine the terminal and social messaging into a powerful force.

In this tutorial, we will discuss using Weechat for Internet Relay Chats on Debian 10. If you’re new to using IRC, this tutorial will help you get started:

Let’s start at the very beginning:

What Is IRC?

Before we get into how to use WeeChat for IRC, let us define a few terms that will make it easier to understand everything we shall discuss:

IRC or Internet Relay chat is a type of application layer protocol used to create and manage IRC networks. IRC networks involve a client/server model that uses a simple IRC client such as WeeChat and a Server to connect to the network.

IRC servers are responsible for transporting messages to users in the connected IRC channels. A collection of more than one IRC server makes up an IRC network, allowing real-time communication between devices.

IRC networks have channels that users can join and communicate within that specific channel. Any registered user in the IRC network can create a channel and share it with other users who want to join.

Users can also create private channels that are usually private and hidden. An example of a channel is the #debian or #ubuntu for Debian and Ubuntu, respectively.

IRC channels are usually prefixed by a pound sign # followed by the channel name.

Users on an IRC network are managed by various characteristics such as their nickname, username, IP address, and real name.

An IRC nickname is a set of characters freely chosen by the user. Nicknames in an IRC network should be unique to each user. You will often hear them referred to as an IRC handle.

The username is simply an identifier for the specific user, which is different from the nickname. Usernames do not necessarily have to be unique.

The IP is simply the internet address of the host device from which the user is connecting.

The real name is an optional identifier that can help identify the user’s real name.

A typical user identity on an IRC is as:

nickname!username@ip

With the basics nailed down, let’s move on and discuss how we can use WeeChat to connect to IRC networks.

Introduction to WeeChat

WeeChat is a simple, powerful, and intuitive C language-written IRC client. WeeChat is cross-platform and can run on Windows, Linux, and macOS. It is highly flexible and supports tool integration written in other programming languages such as Perl, Python, and Ruby.

Since WeeChat is cross-platform and terminal-based, making it a popular choice for many IRC users. It allows terminal customization and extensibility using extensions.

It also allows you to leave the IRC client running in the background as you use the terminal for other remote or local sessions.

Check the official WeeChat site for more details about its capabilities:

https://weechat.org

We need to install WeeChat before we can use it on our system:

How to Install WeeChat

This tutorial only covers WeeChat installation on a Debian system. Check the official documentation for other installation instructions.

https://weechat.org/doc/

WeeChat is available in the official Debian repositories.

Start by updating the system repos using the command below:

sudo apt-get update && sudo apt-get upgrade.

Once we have the system up to date, we can install WeeChat using the command:

sudo apt-get install weechat -y

Running WeeChat

Once you have WeeChat installed on your system, you can launch it by executing the command WeeChat in the terminal.

This command will launch the WeeChat tool as:

How to Use WeeChat

Once you are ready to use WeeChat, we can get started. The first thing we need to learn is how to connect to an IRC server.

Add and Connect to an IRC server

Before we can connect to any IRC server using WeeChat, we need to add it using the /server command:

Here’s an example of adding a Freenode server:

/server add freenode chat.freenode.net

The above command tells WeeChat to add the server chat.freenode.net under the name Freenode.

You are free to use any suitable name for the servers you add.

Once you have a server added, we can connect to it using the /connect command:

For example, to connect to the Freenode server, we added:

/connect freenode

Once you have connected to an IRC server, you can join any channels available in the server using the /join command as:

For example, to join the Debian IRC channel:

/join #debian

To leave a channel or part a channel that keeps the buffer open, you can use the command:

/part [message]

To completely close and leave the channel, use the /close command.

/close

Managing channel buffers

A buffer refers to a component linked to a plugin using a numerical value, a category, and a name. A window is a view on a buffer. By default, WeeChat only displays one window on one buffer. However, you can split windows to view multiple windows with multiple buffers in a single instance.

Check out the IRC documentation to learn more about buffers and windows.

https://modern.ircdocs.horse/

You can use the following commands to manage buffers and windows.

For buffer, use the command:

/buffer

For windows, use the command:

/windows

For example, to split your screen into a large window, use the command:

/window splitv 30

You can remove the split by merging the windows using the command:

/window merge

To switch between buffers, you can call them using the number or their name. For example, to switch to buffer one or buffer #debian respectively:

/buffer 1 or /buffer #debian

WeeChat also supports shortcuts to navigate between buffers. For example, use the ALT+number where the number is the buffer to switch to.

NOTE: By default, WeeChat does not display buffer names or numbers; you will need to install buffer.pl plugin to enable this feature. Check how to install a WeeChat plugin below.

Sending IRC private Messages

You can open a buffer to send a private message to a specific user in an IRC channel.

The general syntax is:

/msg nick message

For example, to send a message to a linuxhint user, use the command:

/msg linuxhint “Check out other articles to gain more knowledge”

If you want to establish a consistent buffer for sending private messages, you can use the /query command.

For example:

/query linuxhint

The command above will open a conversation buffer between you and the specified user.

How to Configure WeeChat

WeeChat is a useful tool for IRC. It provides a wide range of tools and configurations. You can edit the configuration file located in ~/.weechat or use commands to edit the configuration.

WeeChat config Commands

You will mainly use WeeChat commands to interact with users and perform configurations.

All Weechat commands have a preceding forward-slash (/), with most of the commands supported within IRC channels.

Some of WeeChat commands include:

  1. /help – it displays available commands or helps for a specific passed command.
  2. /quit – closes WeeChat sessions.
  3. /close – terminates a specific buffer in WeeChat.
  4. /join – joins a specified channel.
  5. /ms.- sends a private message to a specific user in the current buffer.
  6. /query – opens a private buffer to the specific user.
  7. /kick – removes a user from a channel.
  8. /ban – bans a specific user from a channel.
  9. /kickban – kicks out and bans a user from the channel.
  10. /topic – specifies topic channel.
  11. /whois – displays information about a specified user.
  12. /part – leaves the channel but does not terminate the buffer.

Those are some of the commands you can use to interact and configure WeeChat. To learn more, check out the official documentation.

https://weechat.org/files/doc/stable/weechat_quickstart.en.html#buffer_window

How to Install WeeChat Plugins

WeeChat allows you to extend features and functionality using Plugins, which, in essence, are modifications or extensions of the WeeChat tool. To install a plugin, we use the /script command.

For example, to install the buffer plugin:

/script install buffer.pl

You should always provide the name of the plugin, including the extension.

To view all the scripts available, use the /script command with no arguments.

To get a list of all WeeChat scripts, use the resource provided below:

https://weechat.org/scripts/

How To Setup IRC Nickname and Username

You can also set up the default nickname and username that WeeChat uses on connect. This will remove the hustle of setting up the nickname or username every time you connect to a network.

To set a default nickname, use the command:

/set irc.server_default.nicks "yournickname"

NOTE: You can pass a set of nicknames in case one of them.

To set a default username, use the command:

/set irc.server_default.username "yourusername"

To change an already connected nickname, use the /nick command as:

/nick mynewnickname

Conclusion

We have gone over what IRC networks are, the basics of how they work, and how to install an IRC client on Debian systems and use it to connect to IRC networks. Although this tutorial is short and quick, it covers everything you need to get started with IRC.

To learn more about IRC(s), check out other IRC tutorials on our website.

About the author

John Otieno

My name is John and am a fellow geek like you. I am passionate about all things computers from Hardware, Operating systems to Programming. My dream is to share my knowledge with the world and help out fellow geeks. Follow my content by subscribing to LinuxHint mailing list