How to Install and Configure Tmux for Linux

Tmux is a popular multiplexer that offers a lot of great features. It makes it easy to run different applications in separate sessions and switch between them easily.

How to Install Tmux in Linux

This tutorial introduces how to install and configure Tmux for Linux machines. Activate a Terminal and use the appropriate installation method for your system.

On Debian-based distributions:

sudo install tmux

On CentOS/REHL:

yum install tmux

To install tmux on Arch Linux:

pacman -S tmux

Once the installation is done, launch a Terminal and type tmux to start a new Tmux session. This command will start a new session inside a window and start the shell. The status bar at the bottom shows information about your current session.

tmux

Using Tmux for the first time

Tmux has many concepts like session, window, pane and hotkey. So beginners often find it very intimidating. However, once you have a good understanding of Tmux, you will feel the effectiveness of this tool much more clearly.

A Tmux session defines the task at hand. Windows allows users to perform different operations within a session. Panels, on the other hand, will allow you to work with separate views within the window.

You can manage all of this via hotkeys in Tmux, a combination of the Tmux prefix followed by a specific key. The default prefix is Ctrl + B .

How to manage sessions in Tmux

Tmux can handle multiple sessions at the same time. This allows developers to switch between different projects easily. You can also create a new session anytime you want.

Refer to the article: How to manage and restore Tmux sessions in Linux for more details.

How to manage windows in Tmux

The Tmux window spans the entire screen and can be divided into multiple panes. Each of these panes will act as a separate virtual Terminal. You can create a new tmux window with Ctrl + B c .

Use Ctrl + B , to rename your Tmux window. It will call the Tmux interpreter. Enter the new window name here.

How to Install and Configure Tmux for Linux Picture 1

Tmux makes switching between different windows easy. Enter the Tmux prefix, followed by the window number. For example, you can quickly switch to a second window with Ctrl + B 2 .

You can also swap Tmux windows. To do this, invoke the interpreter by typing Ctrl + B : and enter the following.

: swap-window -s 1 -t 3

This command switches the first and third windows. You can delete a window once done using Ctrl + B & .

How to Install and Configure Tmux for Linux Picture 2

How to manage panes in Tmux

Up to this point, the article has covered how to use sessions and windows in Tmux. However, things get really interesting once you start using panes. Panels are basically virtual terminals that run inside windows. Users can use them to run several instances of Terminal from a single Tmux window.

You can create horizontal and vertical panes in Tmux. Type Ctrl + B " to split the view horizontally.

How to Install and Configure Tmux for Linux Picture 3

This will split the current window horizontally and open a Terminal in a new window. Use Ctrl + B % to start a vertical pane.

How to Install and Configure Tmux for Linux Picture 4

You can create horizontal and vertical panes at the same time. Use hotkey Ctrl + B o to switch between panes.

Changing the zoom level of a pane allows the user to hide all other panes. This feature comes in very handy when you need to focus on a specific task. Use Ctrl + B z to switch panes. You can close the current pane at any time using the hotkey Ctrl + B x .

How to Install and Configure Tmux for Linux Picture 5

How to Configure Tmux in Linux

You can configure almost any aspect of a Tmux installation. However, the article recommends that you start with the basics and move on to more advanced options later.

Configuring Tmux is done by tweaking the ~/.tmux.conf file . Use your favorite Linux text editor to edit this file.

vim ~/.tmux.conf

Let's look at some basic configurations. For example, you can change the Tmux prefix from Ctrl + B to Ctrl + A by adding the line below to the tmux.conf file .

set -g prefix C-a unbind C-b

Unbinding the default key allows you to reassign it to another command. So the second line is an example, nothing is required here.

How to Install and Configure Tmux for Linux Picture 6

You can also change the base index of windows and panes from 0 to 1 , which is very intuitive for users who are not comfortable with 0-based indexes.

set -g base-index 1 # starts window numbering from 1 set -g pane-base-index 1 # starts pane numbering from 1

Since Tmux is a Terminal-driven tool, it does not support mouse functions. However, you can easily enable mouse support for Tmux by adding the file below to your configuration.

set -g mouse on

Hope you are succesful.

4.2 ★ | 5 Vote

May be interested

  • Steps to install Webex for LinuxSteps to install Webex for Linux
    webex is now available for linux. linux communities and users can use webex to bring you live messaging, meetings, and calling in work and education environments.
  • How to install NVIDIA drivers on Kali LinuxHow to install NVIDIA drivers on Kali Linux
    this document explains how to install nvidia drivers on kali linux and supports cuda, allowing integration with popular intrusion testing tools.
  • How to install Kali Linux on Android using Linux DeployHow to install Kali Linux on Android using Linux Deploy
    installing kali linux on android devices is no longer a difficult job thanks to the linux deploy tool. read the following article to learn how to do it.
  • How to install Windows Game on Linux with WinepakHow to install Windows Game on Linux with Winepak
    flatpak is a favorite choice of third-party vendors and proprietary software developers because it allows them to package linux programs once and distribute them on all linux versions.
  • Instructions for installing basic Arch LinuxInstructions for installing basic Arch Linux
    unlike ubuntu or linux mint, arch linux is a distributed linux distribution in a continuous format (rolling release). read the following article to know how to install this distro.
  • How to install and configure Samba on DebianHow to install and configure Samba on Debian
    samba is a powerful open source tool that allows windows-like file and printer sharing on the network in linux systems.
  • How to install Kali Linux on your computerHow to install Kali Linux on your computer
    installing kali linux on your computer is an easy process. first, you will need compatible hardware for computers. kali is supported on i386, amd64 and arm platforms (both armel and armhf).
  • How to install Spotify on LinuxHow to install Spotify on Linux
    spotify has actually supported linux for a long time. although most distributions do not include this application in the repository for license reasons, it is not really difficult to install this official player on a linux pc.
  • How to Install VirtualBox on LinuxHow to Install VirtualBox on Linux
    setting up a virtual machine can be a great way to test alternative software or operating systems on a computer without altering or putting the existing system at risk.
  • How to install Deepin LinuxHow to install Deepin Linux
    deepin linux is an excellent distribution. so why not experience it on your computer? deepin has a variety of high-quality layouts / interfaces and great software.