Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

6
  • 1
    The -p argument outputs to stdout instead of a tmux buffer. Commented Dec 1, 2019 at 6:24
  • 4
    If you are aren't in a local console this won't work so what I've tried is the following: 1) add a horizontal pane below 2) in the local shell, tmux capture-pane -t {top} -pS -1000 > ~/tmp.out Commented Jul 27, 2020 at 13:57
  • 5
    On my tmux (2.6-3ubuntu0.2), you can use -S- to capture all the available history in the pain: tmux capture-pane -p -S- > /tmp/output.txt. First-hand source (I think): man7.org/linux/man-pages/man1/tmux.1.html#COMMANDS, "-S and -E specify the starting and ending line numbers [...] ‘-’ to -S is the start of the history" Commented Mar 14, 2021 at 19:21
  • 5
    Ah, also useful: Use -J so that wordwrapping in your buffer is removed when dumped to a file, caveat is training spaces, so sed can help. Full cmd: tmux capture-pane -p -J -S- | sed -E 's# +$##g' > /tmp/output.txt Commented Mar 24, 2021 at 21:42
  • 1
    @EricCousineau do you understand why -J adds trailing spaces? That is really a shame, I wish I could avoid seding all of them out in case there are actual trailing spaces in the output. Commented Apr 25, 2022 at 11:08