Tmux - Terminal Multiplexer
If you’re like me then you use a terminal a lot. If you were me 20 minutes ago then you would also have multiple terminal tabs open with various applications running. I had heard of an application from some of my peers before about the ability to open multiple terminal panes within the same terminal window. For a while I didn’t look into it, but then (about 20 minutes ago) I had enough of swapping between terminal tabs and the editor I had been using (vscode). The software that I was told about was called screen, which is what is called a terminal multiplexer. After doing some research I found another terminal multiplexer (called tmux) that seemed to be a good contender to screen. I decided that I would try out tmux and see how it goes. With a quick and easy yay tmux
the software was installed. The next thing to do is look for a cheatsheet, which after a quick search I found one.
I have to say, after using tmux for only about 10 - 15 minutes, I am already finding myself absolutely loving it. Not only do I feel more comfortable using Vim as my primary editor now, but I also feel more effective/productive. The commands for using tmux aren’t even that difficult. To start, we create a new tmux session, this is done by entering the command tmux
. The next thing from here is either create a new window (which is done via ctrl + b ~ c
) or split the pane (vertically -> ctrl + b ~ %
or horizontially -> ctrl + b ~ "
). To swap between windows, the command is ctrl + b ~ n (for next) or p (for previous)
. To swap between panes, the command is ctrl + b ~ arrow key direction
. For the icing on the cake there is an ability to detach from the session, which to explain in simple terms, it essentially suspends the session. To re-activate the session, simply enter the command tmux attach
. One thing that tripped me up when using tmux was scrolling. A quick glance at the cheatsheet showed that you can scroll by entering copy mode (ctrl + b ~ [
), then using the arrow keys.