This guide explains how to save the contents of the current pane in tmux to a file.
Step-by-Step Instructions
Capture the Pane’s Content:
- Press prefix key
Ctrl+bto entertmuxcommand mode. - Type
:capture-pane -S - -E -and pressEnter. This captures the entire visible contents of the current pane to a buffer.
- Press prefix key
Save the Buffer to a File:
- Press prefix key
Ctrl+bagain to entertmuxcommand mode. - Type
:save-buffer /tmp/pane_output.logand pressEnter. This saves the buffer content to a file named/tmp/pane_output.log.
- Press prefix key
Combined Command Method
You can capture the pane’s content and save it to a file using the following commands in your shell within the tmux session:
tmux capture-pane -S - -E -
tmux save-buffer /tmp/pane_output.log
