Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to increase scrollback buffer size in tmux?

Tags:

scroll

tmux

How do I increase scrollback buffer size in tmux?

If I enter copy mode, the number of available scrollback lines (visible in upper right corner) is always below 2000. I tried to find a list of all tmux commands, but I can't find anything about scrollback size. For all I see the screen command for setting that option doesn't work with tmux.

Using tmux 1.8, Ubuntu 12.04 LTS, either konsole or gnome-terminal.

like image 492
moon.musick Avatar asked Sep 12 '13 09:09

moon.musick


People also ask

How do I Scrollback in tmux?

The solution is to use tmux specific controls to access its own scrollback buffer: Ctrl-b then [ to enter copy mode, use Down/Up arrows or PageDown and PageUp keys, q or Enter to exit copy mode.

How do I scroll a page in tmux?

Scrolling Up and Down in Tmux If you want to scroll the Tmux terminal, enter the copy mode by pressing the “Ctrl+b” combination and entering “[”. Now, you can use the navigation keys like arrows (up and down) for moving line by line. Left and right arrows can be used for character by character moving.

How do I clear the screen in tmux?

Just type <prefix> + : in the relevant pane and then type clear-history and press enter. If you are on the command line, you can run tmux clear-history in the pane in question for the same effect.


2 Answers

The history limit is a pane attribute that is fixed at the time of pane creation and cannot be changed for existing panes. The value is taken from the history-limit session option (the default value is 2000).

To create a pane with a different value you will need to set the appropriate history-limit option before creating the pane.

To establish a different default, you can put a line like the following in your .tmux.conf file:

set-option -g history-limit 3000 

Note: Be careful setting a very large default value, it can easily consume lots of RAM if you create many panes.

For a new pane (or the initial pane in a new window) in an existing session, you can set that session’s history-limit. You might use a command like this (from a shell):

tmux set-option history-limit 5000 \; new-window 

For (the initial pane of the initial window in) a new session you will need to set the “global” history-limit before creating the session:

tmux set-option -g history-limit 5000 \; new-session 

Note: If you do not re-set the history-limit value, then the new value will be also used for other panes/windows/sessions created in the future; there is currently no direct way to create a single new pane/window/session with its own specific limit without (at least temporarily) changing history-limit (though show-option (especially in 1.7 and later) can help with retrieving the current value so that you restore it later).

like image 85
Chris Johnsen Avatar answered Sep 25 '22 21:09

Chris Johnsen


Open tmux configuration file with the following command:

vim ~/.tmux.conf 

In the configuration file add the following line:

set -g history-limit 5000 

Log out and log in again, start a new tmux windows and your limit is 5000 now.

like image 40
f4d0 Avatar answered Sep 25 '22 21:09

f4d0