Tmux - fun with terminal splitting
Sometimes we need to display a lot of information in one terminal. How to do it? The easiest way to do this is use possibility of splitting terminal into several pseudo-terminals. Let's take advantage of the opportunities offered by Tmux. To begin with, a few words about what tmux is.
Tmux is a multiplexer that allows you to run multiple terminal sessions so that they are available simultaneously in one window.
This is usefull to observe the effect of something we are doing while we are doing it.
Tmux has a lot of features which I will try to show but in that case let's look of the possibility of splitting terminal.
Let's start from the biginning. How do we install tmux. It is very simple.
-
For RedHat Family
yum install tmux
-
For Debian Family
apt install tmux
If you are not a root user you must use sudo - if your user's sudo permissions allow it.
Super. We have tmux installed. Now we can run it. We lounch our favorite terminal or console and execute:
tmux
The most important shortcut that we must remember is the combination control + b becouse almost everything in tmux starts from it
Our case provides for the division of the terminal. We can make a horizontal division - for this we will use a combination of keys:
control + b and %
What will we get after using this combination?
And we have a terminal divided horizontally. Now let's divide one of these terminals vertically. How to do it? In the same easy way as we divided the terminal horizontally. Let's use another key combination:
control + b and "
What does the terminal look like right now?
How can we move between panes. It is quite easy and we have several options to do that. We can use known key combination with additional options:
control + b and the arrow keys
control + b and o
How can we switch panes. We have two choices:
control + b and { or }
control + b and holding control key o
How can we kill the current pane - we can use the key combination:
control + b and x
Finally, last thing for today - resizing the panes. It is the same key combination as we switched between the panes with a small difference - we have to hold the control key. So:
control + b and holding control key use arrow keys
And now when we know these combinations, we can succesfully navigate the tmux terminal panes.
Do you like tmux? Tmux impressed me. In the next tmux episode I will show you more useful features of this tool in. I hope, an equally simple way.
Ave ;)