tmux#
tmux is the terminal multiplexer the operator runs to detach
long sessions from the controlling terminal. Engagements survive
disconnects, the operator’s panel layout follows them across
hosts, and a single tmux a reattaches to whatever the last
session was. The default prefix is Ctrl-b; many operators
rebind it to Ctrl-a for the screen muscle-memory.
Sessions#
A session holds windows; a window holds panes. The session is the unit the operator detaches and reattaches.
$ tmux # new unnamed session
$ tmux new -s engagement # new named session
$ tmux new -s engagement -n recon # new session, first window named
$ tmux ls # list sessions
$ tmux a # attach to the last session
$ tmux a -t engagement # attach to a named session
$ tmux kill-session -t engagement # kill one session
$ tmux kill-session -a # kill all sessions but the current
$ tmux kill-server # nuke the server and everything in it
Inside it#
Every binding below assumes Ctrl-b as the prefix. Letters
after the prefix are typed without modifiers (Ctrl-b then
d, not Ctrl-b Ctrl-d).
Binding |
Action |
|---|---|
|
Detach from the session (leaves it running). |
|
Rename the current session. |
|
Pick another session interactively. |
|
Create a new window. |
|
Rename the current window. |
|
Close the current window. |
|
Previous / next window. |
|
Jump to a window by number. |
|
Split the current pane vertically / horizontally. |
|
Cycle to the next pane. |
|
Toggle between the current and last-active pane. |
|
Cycle through pane layouts. |
|
Toggle pane zoom (fullscreen-in-window). |
|
Close the current pane. |
|
Briefly show pane numbers (then a digit jumps to one). |
Power use#
# In a running session, drop to the command prompt with prefix ":"
# : setw synchronize-panes # broadcast keystrokes to every pane
# : swap-window -s 2 -t 1 # reorder windows
# : set -g mouse on # enable mouse selection / resize
# : set -g history-limit 50000 # bigger scrollback per pane
# Outside a session
$ tmux info # everything the server knows
$ tmux capture-pane -p -S - # dump full scrollback of current pane to stdout
References#
man 1 tmux.