How to Change tmux Scroll Buffer (History)

It’s funny how I discover the settings I would have wanted to change before I run a massive migration script. This is a story of tmux, yet again. tmux is definitely a better tool to have when the work is done remotely over Terminal. The only downside of it all, aside from being old-fashioned CLI, has to be what I took it for granted on local Terminal sessions — history. tmux has limited history or scroll buffer.

Long story short, there are two ways to tackle the issue. On ~/.tmux.conf file, you can change the default tmux configuration to change the value of the limit. The command is set -g history-limit N, where N is your desired value. I believe 2000 is the default tmux value, and the suggestions I’ve read often gave 10,000 to 100,000, depending on the needs. The command, combined with CTRL+B, followed by : (colon), can be entered during the active session too.

I did look into how much memory does this history-limit value really takes. Rough estimate I could find says 100k limit, therefore 100k lines, usually use about 50 MB of memory per pane. Personally, I only keep two, or maybe three at max panes open. The only reason why I prefer to see active history, even though I could redirect the whole logs to an actual text file, is to keep track of my script status. No doubt there are other use cases to set the history-limit to much higher value. But it does seem to be one of those rare scenarios.

Leave a comment

Comments will be automatically closed after 30 days.