learntmux.dev

Scroll, search the scrollback and paste

Goal

The request id from the buried ERROR line is pasted into the right pane.

Lines that scroll off the top of a pane are not gone — they go into its scrollback, and copy mode is how you read them.

C-Up / C-Down
scroll the history one line, the cursor staying put
PageUp / PageDown
a screen at a time
C-r
search backward as you type
C-b ]
paste the newest buffer into the active pane

Search backward, not forward: from the bottom of the history, everything you want is above the cursor. C-r is incremental — the cursor jumps to the nearest match above on every keystroke, Enter stops there, C-g cancels and returns you.

The counter at the top right of copy mode shows how far up you are.

Do this

Press C-b [, then hold C-Up until the counter passes 50.

You are 50 lines up in the history.

Press C-r, type ERROR, Enter.

The cursor lands on ERROR request-id=req-51c2e9a7d4 failed.

Press C-a, C-Space, C-e, then M-w.

The line is copied and copy mode ends.

Press C-b o, type echo with a trailing space, press C-b ], then Enter.

The line prints in the right pane.

Repeating a search

n and N repeat the last search, forward and backward. How many scrollback lines a pane keeps is the history-limit option.

Stuck on this one?

This is a live terminal. Typing goes to the machine, including Tab. Press Shift and Tab together to move focus back out to the page.

A real terminal, in this tab

about 15 MB, once

session learn

Done when

not started
  1. The left pane is in copy mode, scrolled at least 50 lines up from the bottom— not done yet
  2. A paste buffer contains the request id from the ERROR line— not done yet
  3. The request id was pasted into the shell in the right pane— not done yet