Tinkering with Tmux: Common Commands

When in doubt, type Ctrl-B ? to see list of commands.

Session Commands

Split window into 2 horizontal panes
| | ---> | | |
tmux split-window -hCtrl-B %
Split window into 2 vertical panestmux split-windowCtrl-B "
Swap pane with another in the specified directiontmux swap-pane -[UDLR]
UDLR = up, down, left, or right
Ctrl-B { = move pane left
Ctrl-B } = move pane right
(where left right is determined by pane creation order)
Move around panesCtrl-B up_arrow
Ctrl-B down_arrow
Ctrl-B left_arrow
Ctrl-B right_arrow
Go to last active pane
(much like alt-tab in OS to toggle recent window)
Ctrl-B ;
Toggle pane zoom
(temporarily full-screen that pane)
Ctrl-B z
Convert pane to a windowCtrl-B !
Change pane height or widthCtrl-B + arrow_key (hold)
Ctrl-B Ctrl-arrow_key
(no hold)
Close paneCtrl-B x

Window Commands

Start a new sessiontmux
Start a new session named session_nametmux new -s session_name
Continue to the most recent sessiontmux a
tmux attach
Continue to the session named nametmux a -t name
tmux attach -t name
List existing tmux sessionstmux list-sessions
tmux ls
Ctrl-B s
Detach current sessiontmux detachCtrl-B d
Switch to session named s2tmux switch -t s2
Previous sessionCtrl-B (
Next sessionCtrl-B )
Kill all sessiontmux kill-server
Kill all session but currenttmux kill-session -a
Kill all session but s1tmux kill-session -a -t s1
Rename sessiontmux rename-session new_nameCtrl-B $

Pane Commands

Create a new windowtmux new-windowCtrl-B c
Move to the ith windowtmux select-window -t i
(where i is 0 to 9)
Ctrl-B i
Rename current windowtmux rename-window new_nameCtrl-B ,
Then enter new_name
Previous windowCtrl-B p
Next windowCtrl-B n
Close windowCtrl-B &

Vim mode and Copy & Paste

Leave a Reply

Your email address will not be published. Required fields are marked *