To scroll up in tmux, press Ctrl+b, release, then press [ to enter copy mode, and scroll with the arrow keys or Page Up. Press q to leave copy mode and return to the live prompt.
Ctrl+b [ enter copy mode (output in the pane freezes)
PageUp scroll up one page
g jump to the top of the history (vi keys)
M-< jump to the top of the history (emacs keys)
q exit copy mode
Your terminal's own scroll bar does not help here, because tmux redraws the screen and keeps scrollback per pane. Copy mode is how you read that scrollback. Everything below is from the tmux manual page and wiki; for the other default shortcuts see the tmux cheat sheet.
How to scroll up in tmux
- Press
Ctrl+b, release both keys, then press[. The tmux wiki says copy mode "freezes any output in a pane", so new output stops moving the screen while you read. - Scroll with
UpandDown, or a page at a time withPage UpandPage Down. - Press
qto exit.
There is also a shortcut: the default Page Up key, pressed in an ordinary pane, enters copy mode and scrolls one page up in one step. The manual describes it as "Enter copy mode and scroll one page up". The same behavior is available as a command, copy-mode -u.
Keys for moving around in copy mode
Copy mode has two key tables, copy-mode for emacs-style keys and copy-mode-vi for vi-style keys. The mode-keys option picks one. Per the manual, the default is emacs, unless the VISUAL or EDITOR environment variable contains "vi" when the tmux server starts. These are the defaults from the manual:
| Action | Emacs keys | vi keys |
|---|---|---|
| Page up | Page Up | Ctrl+b |
| Page down | Page Down | Ctrl+f |
| Top of history | Alt+< | g |
| Bottom of history | Alt+> | G |
| Search forward | Ctrl+s (incremental) | / |
| Search backward | Ctrl+r (incremental) | ? |
| Start a selection | Ctrl+Space | Space |
| Copy selection and exit | Alt+w | Enter |
| Exit without copying | Escape | q |
The q key is listed in the wiki as "Exit copy mode", and the wiki adds that Ctrl+g stops a selection or search without copying. If you want vi keys regardless of your environment, add this to ~/.tmux.conf:
set -g mode-keys vi
How to search the scrollback
To find an error message that scrolled away, enter copy mode with Ctrl+b [, then search. With emacs keys press Ctrl+r and type the text to search backward, which is usually what you want since the match is above you. With vi keys press ? to search backward or / to search forward, type the text, and press Enter.
How to scroll tmux with the mouse wheel
Mouse support is off by default. The manual says that when the mouse option is on, "tmux captures the mouse and allows mouse events to be bound as key bindings". Turn it on for the current server from inside tmux with Ctrl+b : and then:
set -g mouse on
To keep it, put the same line in ~/.tmux.conf. The wiki also says dragging with the left button inside a pane selects text, and that tmux copies and leaves copy mode when you release the button. The manual excerpt I checked describes the wheel only as a mouse event you can bind (WheelUpPane) and does not list the default wheel binding, so try the wheel after enabling the option and check with tmux list-keys if it does nothing.
One side effect: with mouse on, tmux takes over mouse selection, so your terminal's normal click-and-drag copy stops working. Many terminals let you bypass this by holding Shift while dragging. That varies by terminal, so check yours.
How to keep more history
The number of lines you can scroll back through is set by history-limit, described in the manual as the maximum number of lines held in pane history. Check the current value:
tmux show -g history-limit
Example output:
history-limit 2000
Raise it in ~/.tmux.conf:
set -g history-limit 10000
Reload the file with Ctrl+b : then source-file ~/.tmux.conf. If the old limit seems to persist in an existing pane, open a new window and test there.
If scrolling still doesn't work
- Page Up does nothing. Press
Ctrl+b [first, thenPage Up. If that works, the direct Page Up binding is being overridden by your config or by the program in the pane. - The screen is frozen. You are still in copy mode. Output in the pane is held until you press
q. - The prefix does nothing. If you changed the prefix in your config (for example to
Ctrl+a), use that key instead ofCtrl+b. Runtmux show -g prefixto see the current one. - Old output is missing. It is past
history-limit, or the pane was cleared. tmux cannot recover lines it has already dropped.
Frequently asked questions
- Why can't I scroll up in tmux with my terminal's scroll bar or mouse wheel?
- tmux draws the screen itself, so the terminal has no scrollback of the pane to show. tmux keeps its own history for each pane. Enter copy mode with Ctrl+b then [ to scroll it, or set mouse on in ~/.tmux.conf so mouse events are passed to tmux.
- How do I exit tmux scroll mode?
- Press q. Escape also works with the default emacs-style keys. Pressing q leaves copy mode without copying anything, and output in the pane resumes.
- How far back can I scroll in tmux?
- As far as the pane's history goes. The history-limit option sets the maximum number of lines kept for each pane. Check your value with tmux show -g history-limit and raise it in ~/.tmux.conf.
- Why does Page Up not scroll in tmux?
- The default Page Up binding enters copy mode and scrolls one page up. If it does nothing, enter copy mode explicitly with Ctrl+b [ and then use Page Up, or check that you have not rebound the key with tmux list-keys.