How to save tmux scrollback to a file
Save the whole scrollback of the current pane:
The flags
-p prints to stdout, -S - starts from the very beginning of history (default is just the visible screen), -E sets an end line. -t targets any pane. -J joins wrapped lines back together.
Continuous logging
pipe-pane streams everything that appears in a pane to a command, toggling on repeat invocations:
~/.tmux.conf
bind P pipe-pane -o "cat >> ~/tmux-#W.log" \; display "toggled logging"Related
Verified against tmux 3.6 · updated July 2026 · back to the full cheat sheet