5

I have approximately 400k lines of output to scroll in tmux. How can I speed up the pace of scroll in copy mode? Alternatively, how can I transfer all the (already generated) output content to a file?

dawid
  • 201
  • 2
  • 7

2 Answers2

2

If what you want is to jump to the beginning or end of the buffer, you can do that using the appropriate editor commands. If you have configured tmux to be vi-like, 'g' will jump to the top of the buffer and 'G' will jump to the bottom. I have mine set to be vi-like, so I don't know the emacs keystrokes in this context.

1

I'm not entirely sure I understand the first part of the question:

If you want to scroll faster than one page up at a time, you can add a repeat count to page-up: in copy mode do M-10 PageUp (with emacs key bindings) or 10C-b (with vi key bindings) to scroll up 10 pages at a time. However, I'd rather use the search functionality C-s and C-r for emacs keys and / and ? with vi keys.

To capture the entire history of the pane I would do (needs tmux 2.0 or later):

$ tmux capture-pane -S - -E - # save the history in a paste buffer

In case you have an older version of tmux, give something like -S -400000 as an argument to tmux capture-pane.

You can then paste the history wherever you want with prefix-]. To save the history to a file, do:

$ tmux save-buffer /tmp/myhistory # save the history in /tmp/myhistory

I have the line

bind-key C command-prompt -p 'save history to:' \
         -I '/tmp/tmux-%F_%H_%M.log \
         capture-pane -S -; save-buffer %1'

in my $HOME/.tmux.conf (which I adapted from this answer). This prompts me where I want to save the entire history with a reasonable default.

If you wish to save some memory, delete it using $ tmux delete-buffer.

ariane
  • 26