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:
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:
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.
WeeChat is available in the official Debian repositories.
Start by updating the system repos using the command below:
Once we have the system up to date, we can install WeeChat using the command:
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:
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:
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:
To leave a channel or part a channel that keeps the buffer open, you can use the command:
To completely close and leave the channel, use the /close command.
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.
You can use the following commands to manage buffers and windows.
For buffer, use the command:
For windows, use the command:
For example, to split your screen into a large window, use the command:
You can remove the split by merging the windows using the command:
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:
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:
For example, to send a message to a linuxhint user, use the command:
If you want to establish a consistent buffer for sending private messages, you can use the /query command.
For example:
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:
- /help – it displays available commands or helps for a specific passed command.
- /quit – closes WeeChat sessions.
- /close – terminates a specific buffer in WeeChat.
- /join – joins a specified channel.
- /ms.- sends a private message to a specific user in the current buffer.
- /query – opens a private buffer to the specific user.
- /kick – removes a user from a channel.
- /ban – bans a specific user from a channel.
- /kickban – kicks out and bans a user from the channel.
- /topic – specifies topic channel.
- /whois – displays information about a specified user.
- /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:
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:
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:
NOTE: You can pass a set of nicknames in case one of them.
To set a default username, use the command:
To change an already connected nickname, use the /nick command as:
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.