Introduction to Tmux
John Holbrook from SOLUG (https://solug.org) recommended tmux after I was raving about screen. I thought screen was the greatest thing in the world and had no reason to search an alternative.
Now I don’t know how I ever lived without tmux.
What Is tmux?
Tmux is a software application that can be used to multiplex several virtual consoles, allowing a user to access multiple separate terminal sessions inside a single terminal window or remote terminal session.
Pronuciation: I have no definitive answer, half say “T-mucks” other half “tmox”.
Basic Use
Start tmux
In Ubuntu tmux is not installed by default but you can:
# Install tmux with apt-get:
sudo apt-get install -y tmux
# Alternativley install tmux with snap
sudo snap install tmux
# Start tmux
tmux
Start a new named session
tmux new -s sessionName
Attach to an existing session
If you just want to attach to the first session, no name or -t option is needed.
tmux a -t sessionName
Shortcut Use
Ctrl+b is the default shortcut for tmux
Detach the session
Ctrl+b d
Create new window
Ctrl+b c
Next window
(Ctrl+n)
Previous window
(Ctrl+b)
Rename Window
Ctrl+b ,
See keybindings
Ctrl+b ?
List Windows
Ctrl+b w
Close current window
Note the lack of Ctrl+b here.
Ctrl+d
or Ctrl+b &
Panes
Create Horizontal pane
Ctrl+b “
Create vertical pane
Ctrl+b %
Switch between panes
You can also use the arrow keys instead of o
Ctrl+b o
Close current pane
Ctrl+b x
Show pane number
Ctrl+b q
Distribute panes equally vertically
Ctrl+b, Alt+2
Distribute panes equally horizontally
Ctrl+b, Alt+1
Send Keys to all panes
Ctrl-B :
setw synchronize-panes on