DebugPointer
Published on

How to increase scrollback buffer size of Tmux

How to increase scrollback buffer size of Tmux

Tmux is one of the most useful tool when it comes to using a linux terminal.

Tmux is one of the "terminal multiplexer", it enables a number of terminals (or windows) to be accessed and controlled from a single terminal. It allows you to create a session on a remote box, run applications in that remote session, "detach" from the session, and re-"attach" when desired. It also has advanced features such as multiple windows and split views. Using tmux is recommend when running an interactive CLI program remotely. If you get disconnected from your session, you can re-attach as though nothing happened.

Increase Tmux Scroll History Limit

The default tmux scrollback buffer size is set to 2000 as default value. This scrollback limit of 2000 is set during the pane creation and cannot be changed within for existing panes. The value is taken from the history-limit session option.

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

You can insert the following line in your ~/.tmux.conf file-

set-option -g history-limit <number>

Details of the above command-

set-option is used to set the config in .tmux.conf -g refers that it is a global config. history-limit is the maximum number of lines of history <number> is the value

You can insert it using a direct shortcut-

echo "set-option -g history-limit 10000" >> ~/.tmux.conf

You have to reload changes in tmux config tmux.conf so that it reflects-

tmux source-file ~/.tmux.conf

OR

You can insert the line either by opening the file using vim-

vim ~/.tmux.conf

and then insert it in ~/.tmux.conf-

set-option -g history-limit 10000

You have to reload changes in tmux config tmux.conf so that it reflects-

tmux source-file ~/.tmux.conf

OR

You can insert the line either by opening the file using nano-

nano ~/.tmux.conf

and then insert it in ~/.tmux.conf-

set-option -g history-limit 10000

You have to reload changes in tmux config tmux.conf so that it reflects-

tmux source-file ~/.tmux.conf

You can also clear your tmux history to make it look afresh.

Set the value of the history-limit as per your convenience and use-case. You can also check out the complete tmux cheatsheet of keyboard shortcuts and mouse shortcuts.