This is a overview of how to use TMUX for the people that haven’t used it before.
tmux is a terminal multiplexer for Unix-like operating systems. It allows multiple terminal sessions to be accessed simultaneously in a single window. It is useful for running more than one command-line program at the same time.https://en.wikipedia.org/wiki/Tmux
Learning tmux is a must for anyone looking to be in this field. The ability to have only one window with multiple instances within it helps out tremendously with most everything on Linux.
Tmux is installed by default on Kali Linux, and you can install it with your package manager for Ubuntu, Arch, Parrot, or any other Linux distro.
Once Tmux is installed using it can be daunting as it uses a lot of keyboard shortcuts to get around. I am going to try and make it as easy to use as possible for you. So you can use it with proficiency. I am not going to go fully in-depth but I want to help people get familiar with it.
In order to start Tmux from the terminal we just run this command.
tmux new -s <Name>
Once you run this command you will be put into the tmux shell. We can now explore the wonders of tmux.
I am going to cover a few commands to help you move around tmux. The first command is what I call the “listen” command. When you install tmux by default the “listen” command is:
Ctrl + B
You can edit this within the tmux config file, but I will not be going into configuring tmux in this guide.
This command tells tmux listen for the next key input. You will get very familiar with hitting this hot key as you do it anytime you want tmux to do something.
Lets make a pane bellow the one that I currently have. In order to do this we need to run the “listening command” and another key.
Ctrl + B THEN Shift + "
So the first command can be tricky because it is a 2 part process. You do not hit all the keys at once. Hit ctrl + b, let go of the keys and then press shift + “. This tells tmux I want a pane bellow the one that I currently have.
Now if we want to make a pane to the right of the current terminal we use a pretty similar command.
Ctrl + B THEN Shift + %
In order to move from one pane to another we use a simple command
Ctrl + B THEN (Arrow Key for the pane you want to go to)
So now we can create a pane to the bottom and to the side, also we can move from one pane to another. But say you have three panes open and you need another window. Instead of opening another terminal, tmux allows us to make another window within it. To do this we have to use another shortcut.
Crtl + B THEN c
C means create window, now you may be asking how to go back to the previous window. This can be done with a very similar command.
Ctrl + B THEN p
P allows us to go to the previous window. This can help keep you organized. Please note the word usage between window and pane. In order to move around the panes in a window we use the arrow keys, but in order to move from one window to the next we use P.
Now say you have a long text file and you want to be able to scroll up and down within the pane. Tmux has another hotkey to do this.
Ctrl + B THEN [
This puts the pane into scrolling mode so you can use the arrow keys to move around the text. This is not an editor just a way to view all of the text. When you run this command you will notice a little box on the top right. This is a good visual que to let you know your in scrolling mode. To exit scrolling mode you just have to hit q no need for the listening hotkey.
Now you know how to scroll, make new panes, move around panes, make window, and go from one window to the next.
Tmux offers a lot of commands that you can further learn about but this is the basics of tmux and mostly all that I have found I need to use.
If you want to learn how to customize your tmux there is a great article on this that you can view here.
Also if you want to learn some more of the functionalities of tmux you can view some of the cheat sheets that are online.