Tmux is one of the most used and useful terminal tools for Linux and Unix-like operating systems. Mostly system admins, server admins, and power Linux users use this wonderful terminal tool for more productivity and efficiency. The term Tmux is the shortened form of Terminal multiplexer that can handle multiple terminal tabs and windows simultaneously on the Linux system. The inbuilt system generates a serial number to monitor and look up each active Tmux window on the system. Though this fascinating tool was first released in 2007, from then the demand for this tool is now high. Installing and using the Tmux terminal tool is easy for both Linux server and desktop distributions.
TMUX Terminal Multiplexer in Linux
The Tmux terminal multiplexer tool is written in the C programming language and is built under the ISC license. If you’re a computer and Linux enthusiast, you probably already know that with the OpenBSD computer system, the Tmux comes pre-installed. You can use the Tmux tool to split the terminal window, set vertical and horizontal modes for the terminal shell. Since Tmux is an open-source tool, you can find the entire source code in this GitHub repository.
After you install the Tmux on your Linux system, you can always find out the installation files inside the /etc/tmux.conf
directory to restore or fix issues. In this post, we will see how to install and use the Tmux tool on a Linux system.
Step 1: Install Tmux on Linux
Installing the Tmux terminal tool on a Linux system is as easy as pie. You just need to make sure that your system repository is up to date and you have an active internet connection. Then, please execute the appropriate command from the commands given below according to your distribution.
- Install Ack tool on Ubuntu/Debian Linux
$ sudo apt-get install tmux
- Get the Ack Tool on Fedora/Red Hat Linux
$ sudo yum install tmux
- Install Ack on Arch-based Linux systems
$ sudo pacman -S tmux
- Install Ack on SuSE Linux
$ sudo zypper install tmux
After we get the Tmux tool installed, we just open it from the default terminal shell by typing tmux
 on the shell.
$ tmux
Step 2: Get Started with Tmux on Linux
So far, we have gone through a brief feature and use-case of Tmux and the installation process. Now, we will see a few use-cases and operations of Tmux on Linux. For demonstration purposes, I am going to use a Ubuntu desktop, but the following commands will be executable on any other major Linux distributions as well.
1. Open and Play with Tmux
At the very beginning, we will need to get started with the Tmux tool. To open the Tmux tool, simply type tmux and hit the enter button. This command will create a new Tmux window with a default numeric session name.
$ tmux
If you need to create a new Tmux session with a customized name, execute the following Tmux command on the shell.
$ tmux new -s new_session_name
The most common and very often use of Tumx would be de detaching an active window from the Tmux shell. This feature might help you to multitask and be more productive. You can use the following keyboard shortcut to detach the current window.
2. Attach and Detach Tmux on Linux
If you detach an active window by accident, no worries, you can get that back attached to the Tmux session. Execute the following key combinations from your keyboard to get back your detached window.
Ctrl+b d
Ctrl+b d
In addition, you can also see the list of all Tmux sessions so that you can call any session you want by serial id.
$ tmux ls
You can also attach sessions on Tmux with the session name.
$ tmux attach-session -t ubuntuPIT_tutorials
3. Duplicate Tmux Window
If you’re a system admin, you might need to run similar terminal commands repeatedly for the entire day in the same terminal environment. You can copy a session with all the settings to another tab through the Tmux terminal tool on Linux.
Ctrl+b c
Ctrl+b w
You may now switch between any sessions or tabs by the session number or the windows name in Tmux.
Ctrl+b window_number
Ctrl+b 1
If you need to rename the current or any session, simply press the following key combination from the keyboard to rename it.
Ctrl+b ,
4. Navigate Tmux
The following commands that will allow you to shift the Tmux terminal tool on your Linux session are very important and handy for every power user. Run the following key combinations to make the Tmux window horizontal.
Ctrl+b %
The following key combination will allow you to put the window in vertical mode.
Ctrl+b "
Finally, you may now navigate all the windows on the Tmux terminal shell on your Linux machine through the following navigational key combinations.
Ctrl+b o
Ctrl+b ;
Ctrl+b x
Step 3: Get Familiar with a few most used Tmux keyboard shortcuts
Power Linux users love to operate the system from the keyboard only, which is not only professional but also efficient. Here, we will see two sets of keyboard shortcuts or combinations that are really helpful for operating Tmux on Linux.
CTRL+b + (.
– Use this keyboard shortcut to go to the previous tabCTRL+b + )
– Move to the next windowCTRL+b + s
– Show all the active sessionsCTRL+b + d
– Disengage the active sessionCTRL+b + $
– Give a name to the Tmux windowCTRL+b + L
– Choose the running sessiontmux ls
– Print all running sessionstmux attach -t 0
– Expand or Zoom in the active window/sessiontmux kill-server
– Dismiss all sessions
The following set of keyboard combinations will let you control and manage the active, running, and listed sessions on Tmux.
CTRL+b + c
– Run a new sessionCTRL+b + p
– Go back to the prior tabCTRL+b + n
– Shift to the following window.CTRL+b + 0-9
– Turnabout to a windowpane by tab numberCTRL+b + w
– Open a window from a menu.CTRL+b + &
– Stop all sessions that are not working.CTRL+b + %
– Horizontally split current active window.CTRL+b + “
– Vertically split the current Tab.exit
– Close a window on Tmux
Ending Words
No doubt, definitely Tmux is one of the best terminal tools for Linux. Despite having a default terminal tool, do you need to get another terminal tool? Many would not bother, but if you want to increase your efficiency and get the feel of the professional feeling of Linux, you must give Tmux a shot. Using Tmux is harmless; moreover, it supports key bindings, clipboards, and web browsing through the terminal tool.
In the entire post, we have described how to install Tmux on different Linux distributions and how to use Tmux on Linux. Please share it with your friends and the Linux community if you find this post useful and informative. You can also write down your opinions regarding this post in the comment section.