I got introduced to tmux when I joined a seminar on Docker. While listening to the speaker going through the topics, and seeing how easily he went through folders in Linux and how he switched between panes – I immediately saw a solution to some problems I have. When I reached home, I got my hands dirty…
From the tmux github repo:
Tmux is a terminal multiplexer. It lets you switch easily between several programs in one terminal, detach them (they keep running in the background) and reattach them to a different terminal. And do a lot more.
I keep several apps and services in the cloud. I connect to them via SSH using bash. Working on a terminal and running only one command each line is a headache for me. Much more, when the terminal times out you have to relogin again. Tmux is the solution to remedy these problems.
Currently, the only features from tmux that I’m using is opening several panes. Opening only two horizontal panes will do for me. I can move from one pane to the other. I can edit some codes on one, then move to the other pane to execute commands.
Several commands are available but here are the few that gets me through:
Starting/Ending a tmux server and/or session
Writing this on the Linux terminal will start the tmux server and an unnamed session. This gets me through when I’m on a hurry. But if you want to name it so you can get back to it later, then you may
>> tmux new -s session_name
If you want to list the current sessions, you may write:
>> tmux list-sessions
The tmux server may be ended with the command:
>> tmux kill-server
Or to kill a session with name session_name you may:
>> tmux kill-session session_name
Tmux Panes and Pane Navigation
Some tmux commands are preceded by Ctrl+B. For example to create a horizontal pane you may write: Ctrl+B ” – which actually could be Ctrl+B Shift ‘.
Split current pane into 2 vertical panes: Ctrl+B % Split current pane into 2 horizontal panes: Ctrl+B " Show pane numbers: Ctrl+B Q Shown pane number and go to that pane with pane_number (number designation): Ctrl+B Q pane_number When traversing two panes, you may go from one pane to another with: Ctrl+B ; Closing the current pane: Ctrl+B x (You may be prompted to answer y or n)
So there you go. These are the essentials I found so far.