tmux for dummies — more use cases

page 2: everything else that makes tmux worth it on a remote box.

1. multiple windows (tabs in one SSH connection)

one window for the editor, one for logs, one for the shell — one SSH session.

Ctrl-b ccreate new window
Ctrl-b n / pnext / previous window
Ctrl-b 0..9jump to window by number
Ctrl-b ,rename current window
Ctrl-b wlist windows, pick with arrows

2. split panes (side-by-side)

tail a log while editing a config, without a second terminal.

Ctrl-b %split vertically (left / right)
Ctrl-b "split horizontally (top / bottom)
Ctrl-b arrowsmove between panes
Ctrl-b zzoom pane fullscreen (again to unzoom)
Ctrl-b xkill current pane

3. long jobs overnight

tmux new -s train
python train_model.py        # runs for hours
Ctrl-b d                     # detach, log off, sleep
# next morning:
tmux attach -t train         # check on it

4. scroll back through output

remote terminals often can't scroll. tmux can:

Ctrl-b [enter scroll (copy) mode
arrows / PgUpscroll around
qquit scroll mode

5. pair work / shared session

two people SSH into the same server and attach to the same session — both see and type in the same terminal:

# person A:
tmux new -s pair
# person B:
tmux attach -t pair

6. several projects, one server

tmux new -s clientA
tmux new -s clientB
tmux ls                      # see them all
tmux attach -t clientA       # jump between contexts
Ctrl-b s                     # switch sessions from inside tmux

7. housekeeping

tmux kill-session -t namekill one session
tmux kill-serverkill everything (nuclear)
Ctrl-b ?list all keybindings