In the world of Linux, terminal multiplexers are essential tools for developers, system administrators, and power users, as they allow you to manage multiple terminal sessions within a single window, making your workflow more efficient and organized.

One of the newest and most exciting terminal multiplexers available today is Zellij, which is an open-source terminal multiplexer designed to simplify and enhance the way you work in the command line.

Unlike traditional multiplexers like tmux or screen, Zellij offers a unique layout system, keybindings that are easy to learn, and a plugin system that allows for customization.

You can find the official repository for Zellij on GitHub, which is actively maintained by a community of developers who are passionate about improving the terminal experience.

Key Features of Zellij

  • Pane Management: It allows you to split your terminal window into multiple panes and tabs, either horizontally or vertically.
  • Session Persistence: One of the standout features of Zellij is its ability to save your session from accidentally closing the terminal.
  • Customizable Layouts: It comes with pre-defined layouts that you can use to quickly set up your workspace.
  • Plugin Support: It supports plugins, which means you can extend its functionality by adding new features.
  • Mouse Support: Unlike some terminal multiplexers that rely solely on keyboard shortcuts, Zellij also supports mouse interactions.
  • Status Bar: It includes a status bar at the bottom of the screen that displays useful information, such as the current time, battery status, and the name of the current session.

Installing Zellij on Linux

Zellij can be installed on various Linux distributions through the default system package manager as shown.

sudo apt install zellij         [On Debian, Ubuntu and Mint]
sudo dnf install zellij         [On RHEL/CentOS/Fedora and Rocky/AlmaLinux]
sudo emerge -a sys-apps/zellij  [On Gentoo Linux]
sudo apk add zellij             [On Alpine Linux]
sudo pacman -S zellij           [On Arch Linux]
sudo zypper install zellij      [On OpenSUSE]    
sudo pkg install zellij         [On FreeBSD]

If a package is not available, you can download a prebuilt binary from the latest release and place it in your $PATH.

wget https://github.com/zellij-org/zellij/releases/download/v0.41.2/zellij-x86_64-unknown-linux-musl.tar.gz
tar -xvf zellij-x86_64-unknown-linux-musl.tar.gz
chmod +x zellij
./zellij

A better approach is to move Zellij to a system directory that is already included in your $PATH, such as /usr/local/bin or ~/.local/bin.

sudo mv /home/ravi/zellij /usr/local/bin/

Now, you can run zellij from anywhere.

Alternatively, if you have Rust installed, you can compile and install Zellij using Cargo:

cargo install zellij

For those who prefer to try Zellij without installing it, there are options available for different shells.

bash <(curl -L https://zellij.dev/launch)           [For bash/zsh]
bash (curl -L https://zellij.dev/launch | psub)     [For fish]

These commands will launch Zellij directly without a full installation.

Getting Started with Zellij

Once Zellij is installed, you can start it by simply typing zellij in your terminal, which will open a new Zellij session and help you choose between two keybinding modes.

If you’re new to Zellij, stick with Default Mode, as it provides direct keybindings for switching modes.

Zellij Setup Wizard
Zellij Setup Wizard

Basic Zellij Commands

Here are some basic commands to help you get started:

  • Split Panes: You can split the current pane horizontally by pressing Ctrl + o followed by -, or vertically by pressing Ctrl + o followed by |.
  • Switch Between Panes: You can switch between panes using the Ctrl + o followed by the arrow keys (, , , ).
  • Resize Panes: To resize a pane, press Ctrl + o followed by Shift + arrow keys.
  • Close a Pane: To close the current pane, press Ctrl + o followed by x.
  • Create a New Tab: You can create a new tab by pressing Ctrl + o followed by n.
  • Switch Between Tabs: To switch between tabs, press Ctrl + o followed by Tab.

Working with Layouts

Layouts are one of Zellij’s most powerful features, where you can load a predefined layout using the following command in command mode:

layout my_layout

You can create your own layouts by editing .kdl files (Kiss Document Language) is a human-readable format used by Zellij for configuration.

Managing Sessions

Like other terminal multiplexers, Zellij lets you create and manage multiple sessions.

To list all active sessions, run:

zellij list-sessions

To attach to a specific session, use:

zellij attach session_name

Customizing Zellij

Zellij provides extensive customization options through its configuration file, typically located at ~/.config/zellij/config.kdl. Here, you can modify keybindings, define default layouts, and enable plugins.

For example, to change the prefix keybinding from Ctrl + o to Ctrl + b, add the following to your config file:

keybind {
    prefix "Ctrl-b"
}

This configuration file defines custom keybindings for creating new panes and closing them.

Plugins and Extensions

Zellij’s plugin system is another area where it shines, plugins can be written in any language, and they interact with Zellij via its API.

Some popular plugins include:

  • Status Bar : Displays system information like CPU usage and memory.
  • File Picker : Allows you to browse and open files directly from Zellij.
  • Tab Management : Enhances tab navigation and organization.

To install a plugin, simply place its script in the ~/.config/zellij/plugins directory and reference it in your configuration file.

Conclusion

Zellij is a powerful and user-friendly terminal multiplexer that brings a fresh approach to managing terminal sessions. With its flexible layouts, intuitive keybindings, and robust plugin system, it has quickly become a favorite among Linux users.

Whether you’re a seasoned developer or just starting with the command line, Zellij offers tools that can significantly boost your productivity.

Similar Posts