Copy entire visible contents of pane to a buffer
copy mode
// what it does
`capture-pane` copies the pane's contents into a paste buffer — a new buffer by default (which becomes the most recent), or the one named with `-b`. It's the scriptable, mouse-free way to grab a pane's output — add `-p` to print to stdout instead of a buffer, `-S`/`-E` to set the start/end lines, and `-J` to join wrapped lines.
// tmux command
: capture-pane// gotcha
With no flags it captures only the visible screen — scrollback above the viewport is excluded unless you pass a start line, e.g. `capture-pane -S -` for the whole history (`-` means the start of history). Without `-J` (or `-N`), long wrapped lines are captured as separate lines and trailing spaces are dropped.