Skip to content

tmux ​

tmux lets you split one terminal into several panes, for example an AI agent on the left and a shell or editor on the right. Start it inside the container with:

bash
tmux

Key bindings ​

The prefix key is the tmux default, Ctrl+b: press Ctrl+b, release both keys, then press the next key.

KeysAction
Ctrl+b then |Split side by side (new pane on the right)
Ctrl+b then -Split top and bottom (new pane below)
Ctrl+b then cNew window
Ctrl+b then arrow keysMove between panes
Ctrl+b then [Enter copy mode (scroll with the keyboard; q to leave)
Ctrl+b then dDetach; the session keeps running, tmux attach brings it back

New panes and windows open in the current directory. Windows and panes are numbered from 1.

A window whose background panes produce new output is highlighted in the status bar, which helps when several agents run at once.

Scrolling and copying ​

Mouse support is on, so everything works per pane:

  • Scroll: the wheel scrolls the history of the pane under the pointer (up to 50,000 lines). Press q or scroll back to the bottom to return.
  • Copy: drag to select. The text is copied the moment you release the mouse button and the selection clears, so the keyboard goes straight back to the program. There is no need to press Cmd+C / Ctrl+Shift+C, which copies nothing here.
  • Keyboard copy: in copy mode, press v to start a selection and y to copy it (vi keys).

Programs that handle the mouse themselves, such as Claude Code and Neovim, still receive the wheel and drags in their own pane.

Host terminal settings ​

Copied text travels from tmux to your computer's clipboard through the OSC 52 escape sequence. Your terminal on the host has to allow it:

TerminalSetting
GhosttyNothing to do; clipboard writes are allowed by default
iTerm2Settings → General → Selection → enable Applications in terminal may access clipboard
Other terminalsEnable OSC 52 / "allow programs to write to the clipboard" if the terminal supports it

Using the terminal's own selection ​

To bypass tmux and select with your terminal instead, hold a modifier key while dragging:

  • Ghostty: Shift
  • iTerm2: Option

This selection covers whole lines across all panes, and you copy it with the terminal's usual shortcut.