1. Overview
Often, we need to open more than one terminal at the same time. For example, we may want to make gradual changes to a configuration file and restart the program that uses it without constantly closing our editor. This can significantly improve productivity and efficiency. Indeed, there are many tools in Linux to get more than one terminal within a single window.
In this tutorial, we’ll explore different approaches for spawning multiple terminals in one window. We’ve tested this tutorial on Ubuntu 22.04.
2. Why Use Multiple Terminals
Having many terminals in a single window can provide many advantages:
- enable efficient multitasking
- easy remote management
- facilitate copy-pasting
- contextual organization of tasks
Additionally, this practice is resource-efficient and helps in script development and testing. Also, it’s a great way to handle tasks that take a long time.
Terminal multiplexers and terminal emulators usually have many keyboard shortcuts. Hence, this makes it easy to switch between terminals when we have more than one, even in a non-graphical environment. Thus, we can make our command-line use more efficient.
3. Using Terminal Emulators
A terminal emulator is a program that lets us use a raw terminal in a more convenient, often graphical, way. Some terminal emulators provide native support for displaying multiple terminals within a single window.
Let’s look at some commonly used terminal emulators that serve our purpose.
3.1. Terminator
Terminator is a terminal emulator with lots of features, including splitting a terminal window in two either horizontally or vertically.
We can install Terminator using the package manager of our Linux distribution. For example, on Ubuntu, we’ll use the apt package manager:
$ sudo apt install terminator
After installing, Terminator can be started from the application menu. Another way to start Terminator is to type terminator in the terminal:
$ terminator
Further, there are a couple of key combinations to get multiple terminals in a single window:
- horizontal split: Ctrl + Shift + o
- vertical split: Ctrl + Shift + e
Furthermore, we have quick ways to switch between these windows:
- next window: Ctrl + Tab
- previous window: Ctrl + Shift + Tab
New Linux users often use Terminator because it’s usually easier to configure.
3.2. Tilda
Tilda is a lightweight and highly customizable terminal emulator, which supports multiple terminals in a single instance.
Again, to install Tilda, we can use the package manager specific to our distribution. For example, on Debian-based systems like Ubuntu, we can use the apt program:
$ sudo apt install tilda
Same as before, once Tilda is installed, we can start it directly from the application menu. Alternatively, we can type tilda on the command line to launch it:
$ tilda
On its first run, Tilda creates a default configuration file and shows the setting window. To keep the default settings, we can just accept it by pressing the OK button.
Each time we start Tilda, it configures itself with the default keybindings. For example, the first instance is bound to and controlled by the F1 key, the second by the F2 key, and so on.
Now, let’s see how to open multiple terminals in Tilda. In fact, this terminal emulator supports the feature via tabs. Furthermore, Tilda has a default hotkey association for opening a tab:
- new tab: Shift + Ctrl + t
Furthermore, we’ve got several key bindings to manage these tabs:
- next tab: Ctrl + PageUp
- previous tab: Ctrl + PageDown
- close the current tab: Shift + Ctrl + w
- exit: Shift + Ctrl + q
Unlike Terminator, Tilda doesn’t support horizontal and vertical splits.
4. Using Terminal Multiplexers
Terminal multiplexers such as tmux can effectively manage multiple terminals within a single window. To do this, they can either use panes or tabs, thus enabling work with multiple shell sessions concurrently.
Additionally, terminal multiplexers let us detach the current terminal session and reattach it later. This feature can significantly improve our workflow, especially when working with remote machines. Consequently, it eliminates the need of using nohup commands and other workarounds.
Let’s see three popular terminal multiplexers: tmux, screen, and byobu. All three can spawn multiple terminals inside a single window.
4.1. tmux
tmux is a powerful terminal multiplexer that has a wide range of features. Let’s look at how to have more than one terminal in a single window using tmux.
First, we start a new tmux session:
$ tmux new-session
Once we’re in the tmux session, we use the following key pairs to split the terminal window vertically or horizontally:
- vertical split: Ctrl + b, then %
- horizontal split: Ctrl + b, then “
After splitting, we can see multiple terminal panes in the same window:
To switch between the split panes, we can use three shortcuts:
- Ctrl + b, then Arrow Key (Left, Right, Up, Down)
- Ctrl + b, then o
- Ctrl + b, then ;
We can subdivide each pane to make even more terminals. This lets us work on and monitor many tasks in parallel.
4.2. screen
screen is another terminal multiplexer that provides features like window splitting and session management.
Let’s create a new screen session:
$ screen
Within the screen session, we can split the window vertically or horizontally using similar key combinations to those of tmux:
- vertical split: Ctrl + a, then |
- horizontal split: Ctrl + a, then S (Uppercase)
Similarly, to navigate between the split panes, called windows, we can use again shortcuts:
- next window: Ctrl + a, then Tab
- previous window: Ctrl + a, then Shift + Tab
tmux and screen both provide a similar feature. In general, they have many of the same characteristics. However, tmux is a bit more modern.
4.3. byobu
byobu* is a wrapper around screen or *tmux. It’s meant to make their feature set even better and give users a better experience. For example, it comes with a lot of features like split windows, status notifications, and keyboard shortcuts. Furthermore, byobu is generally more customizable and easy to use. This makes working with terminal sessions simpler.
On Ubuntu, we can use the apt command to install Byobu:
$ sudo apt install byobu
After installation, we can start byobu from the application menu or from the terminal by typing byobu:
$ byobu
Once we’re in a byobu session, we can split the terminal window vertically or horizontally to make more than one terminal within the same window:
- vertical split: Ctrl + F2
- horizontal split: Shift + F2
Let’s check how this looks:
Also, we can use the arrow keys and the Shift key together to move between the split terminals.
5. Conclusion
In this article, we saw ways to open more than one terminal window in Linux.
First, we talked about Terminator and Tilda, which are terminal emulators. Then, we talked about the tmux, byobu, and screen terminal multiplexers.
Overall, both ways make it easier to have multiple terminals open simultaneously within the same window in Linux.