How to Install ERPNext on Rocky Linux 9 3

How to Use tmux Command in Linux

With the help of the tmux command in Linux, you can select between different Terminal inputs and run different processes at ease. It is a command-line utility that removes all the multitasking limitations of a conventional terminal window.

Running multiple processes simultaneously can be troublesome, especially with the usual Terminal window hindrances. For instance, you’re not allowed to initiate a process with a terminal window and get started with another one at the same time; instead, you’ll need to pause the first one. 

This is when tmux clicks in as a day saver. With the tmux command in Linux, you can create multiple windows, and the best thing is that they superimpose flawlessly. For that reason, neither the data nor the results of varied processes get mixed up. 

Thus, tmux or, the Terminal Multiplexer overpowers these limitations by creating its own window even while it is operating.

Installing tmux in Linux

Installing the tmux command in Linux is pretty straightforward. You can use your distro’s package manager and invoke commands according to the system you’re running.

On CentOS and Fedora

$ sudo yum install tmux

Getting tmux Installed On Ubuntu and Debian

$ sudo apt install tmux

On macOS

$ brew install tmux

But before you do that, make sure to check if tmux is already available on your system. Launch the Terminal and run $ tmux --version. If it prints something that states the unavailability, go ahead and install the package.


$ tmux –version

Output: If installed

veryfing tmux command in linux

Output If not installed

output when tmux is not installed

Getting Started with tmux Command in Linux

To start your first tmux session, you’ll need to launch the terminal using the “Ctrl+Alt+T” key combination and then execute the tmux flag. Invoking the code will create a new window and initiate a shell.

After starting the tmux session in Linux, a status line appears at the bottom of the screen. It generally displays information about the session on which you’re currently operating.

Running the first tmux Command in Linux

Once the session is started, you’re ready to run your first tmux command. Now in case, you don’t know how to get the list of commands that associates with tmux in Linux, execute the following code:

$ Ctrl+b ?

Using tmux Command in Linux

Creating Named Sessions

Although tmux sessions are named numerically, you can employ some commands and rename them. Specific naming comes in handy when you intend to run multiple sessions at a time.

Renaming is pretty simple. All you need to do is use the -s flag alongside the tmux command in Linux, followed by the desired session name.

$ tmux new -s desired_session_name
creating named sessions

Getting Detached From any tmux Session

Are you done working with the created tmux session and willing to detach yourself from the same? Well then, run Ctrl+b d. It will return you to the normal shell, exiting from the tmux session. 

Keep in mind; any running program will continue in its state even after detaching from the session.

Reattaching to the Desired tmux Session

Before you attach to a session, it is crucial to derive info about it, especially the name. You can do that by using the ls flag together with the tmux command in Linux. From the displayed output, the first column indicates the session’s name.

$ tmux ls
finding tmux session name

Once you’ve got the session name noted, pass the –attach-session flag alongside -t followed by the name. For instance, if the session you want to attach to is named bug_fixing, run the command as:

$ tmux attach-session -t bug_fixing
reattaching to sessions using tmux command in linux

Working with tmux Windows and Panes

As soon as you start a tmux session, a single window gets created by default with a shell. However, you instruct the system to create multiple windows by using the Ctrl+b c command.

Switching Between Windows

Use Ctrl+B followed by a number that defines the window you want to switch to. For instance, Ctrl+B 1 will switch to window 1.

Killing a Window

Killing a Window is not similar to getting detached from a session. As already mentioned, a process will continue to run even when you detach from a session, but the scenes are different from killing. You usually kill the processes involved when you decide to kill a window.

Use Ctrl+b & in the tmux session.

You’ll then get a message saying, kill-window bash? (y/n)

kill window

Press y to kill the window, or else go with the n option.

Managing tmux Windows and Panes

There are a number of ways in which you can manage tmux windows and panes. Below listed are some of the common commands that will help in various situations.

Using Ctrl+b c will help you create a new window with a shell

Invoking Ctrl+b 0 lets, you switch to the desired window (in this case, it is 0)

Passing Ctrl+b w is a way to choose a window from the list.

Executing Ctrl+b x will close the current pane.

Using Ctrl+b ; helps you toggle between the previous and currently working pane.

When you pass Ctrl+b o, you can go to the next pane.

Ctrl+b “ splits the current pane vertically into two panes.

With Ctrl+b , you can rename the pane.

Ctrl+b % is used for the horizontal splitting of panes.

Customizing tmux in Linux

tmux in Linux features an amazing capability that allows users to customize it in many ways. The tmux command-line in Linux actually reads its configuration from a file named ~/ .tmux.conf as soon as the session is started. Hence, you can customize the file with additional options.

And with that, we’re done talking about the tmux command in Linux. In this article, we’ve talked about the ways in which you can install the tmux package on varied systems. 

We’ve also discussed the ways you can create a tmux session, detach and attach to the same, create new window panes, switch between windows, personalize the tmux command, and many more in the most efficient manner.

If this guide helped you, please share it.

Leave a Reply
Previous Article
How to Install ERPNext on Rocky Linux 9 4

How to Use pushd Command in Linux

Next Article
How to Install ERPNext on Rocky Linux 9 5

How to Use mknod Command in Linux

Related Posts