I know that I’m probably 10 years late but I just started to use Tmux and I don’t know how I can have lived without it in the past.
Tmux is just GREAT!!!
You can run multiple terminal, switch between them, split screen horizontally and vertically as much as you need.
You can save session and leave code running. You can detach from a session, close the ssh connection.
Reconnect to your server later and reattach to the Tmux session and see the progress.
First you need to install Tmux
I’m on Debian server so I use apt-get.
apt-get install tmux
When installed you are ready to go.
Nothing to configure, nothing fancy.
I will list the basic command to use Tmux
Create a session that you can detach or re-attach
tmux new -s namethesession In my case tmux new -s matt
Connect to your session
tmux a -t nameofthesession In my case tmux a -t matt
Kill a Tmux session
tmux kill-session -t nameofthesession In my case tmux kill-session -t matt
For the rest you need to be in Tmux.
When in Tmux, all Tmux command NEED to be previously CTRL + B
tmux a -t matt (connect to tmux session matt) Ctrl+b Then d (detech from the tmux session matt)
Basic Command List
Detach from the current session
c (Create Window)
w (List Window)
n (Next Window)
p (Previous Window)
, (Name the currently selected window)
& (Kill the currently selected window)
Panes (splits view in the window)
% (Split Vertically)
” (Split Horizontally)
o (Swap pane)
x (Kill pane)
: resize-pane -D (Resizes the current pane down)
: resize-pane -U (Resizes the current pane upward)
: resize-pane -L (Resizes the current pane left)
: resize-pane -R (Resizes the current pane right)
: resize-pane -D 20 (Resizes the current pane down by 20 cells)
: resize-pane -U 20 (Resizes the current pane upward by 20 cells)
: resize-pane -L 20 (Resizes the current pane left by 20 cells)
: resize-pane -R 20 (Resizes the current pane right by 20 cells)
: resize-pane -t -L 20 (Resizes the pane with the id of 2 left by 20 cells)
t (Clock in the pane)