Question Details

No question body available.

Tags

tmux

Answers (1)

Accepted Answer Available
Accepted Answer
June 15, 2025 Score: 0 Rep: 21,349 Quality: High Completeness: 50%

-S -10 -E -1 would not work since it's capturing the most recent 10 lines in history.

According to man tmux:

-S and -E specify the starting and ending line numbers, zero is the first line of the visible pane and negative numbers are lines in the history. '-' to -S is the start of the history and to -E the end of the visible pane. The default is to capture only the visible contents of the pane.

So there's no direct way to specify "last 10 lines of output".

If all your panes are of the same size you can work it around by using $LINES:

tmux capture-pane -p -t test:0.0 -S $((LINES - 10)) -E -

Note that this works only if the most recent output is at the bottom most of the pane, otherwise the result would include blank lines.