The detach/reattach loop is tmux's reason to exist
Internalize this rhythm and tmux pays for itself within a week:
tmux new -s work— start a named session.- Set up your panes, run your processes, leave them running.
prefix + d— detach. Close your terminal. Walk away. Sleep. Travel.tmux attach -t work— reattach. Everything is exactly as you left it: running processes, scrollback, cursor positions.
Over SSH this is even more powerful. Start tmux on the remote box; SSH from your laptop, run a long task, detach, disconnect the SSH session — task keeps running on the server. Reconnect from anywhere later, reattach, see the result.
Copy mode — scrolling, searching, and copying
Inside tmux, the mouse wheel doesn't scroll the shell's output by default — you're in a multiplexer, not a terminal. To navigate scrollback, you enter copy mode with prefix + [. Now arrow keys (or vi keys, if configured) scroll. q exits copy mode.
Inside copy mode
With setw -g mode-keys vi (Track 6), copy mode uses vi-style navigation:
- Movement:
h j k l,w b e,0 $,gg G— same as Vim. /patternsearch forward,?patternbackward,n/Nnext/previous match.Spacestart a selection, motions extend it,Entercopy the selection (and exit copy mode).vtoggles rectangle selection.qexit copy mode.
Pasting
prefix + ] pastes the most recent tmux copy. With the right config (Track 6), copies in tmux also go to your system clipboard so Cmd-V / Ctrl-V works in other apps.