How to increase the scrollback buffer in a running screen session on Linux?

LinuxOperating SystemOpen Source

Screen or sometimes also known as GNU Screen, is a terminal multiplexer. What it means is that it allows you the privilege to start a screen session and then open any number of windows inside that session.

It might also be interesting to note that a process that is running in Screen will continue to run even when their window is not visible anymore.

Installing Linux Screen

In order to install the screen package if it is not already present on your linux distribution, you can run any of the suitable commands shown below for your machine.

For Ubuntu and Debian

sudo apt update
sudo apt install screen

For CentOS and Fedora

sudo yum install screen

Starting Screen

You can start a screen session by typing the command shown below in your terminal.

screen

Now we know how to install a screen and make use of it, the following command shown below will list all of the screen sessions for a user.

When it comes to increasing the scrollback buffer in a running screen session, it is not possible to retroactively increase the scrollback buffer length in the current session in order to recover the old lines that have already been discarded. Instead, what you can do is change the current scrollback parameter setting.

To change the current rollback parameter setting on your linux machine for a current session follow the steps shown below

Press CTRL + A, followed by − then type the command shown below

scrollback <num>

Where num is the number of lines of scrollback that you want for your current screen session.

It should also be noted that you can also set the default number of scrollback lines by typing the following command

defscrollback <num>

Where num means the same as in the previous command.

raja
Updated on 29-Jul-2021 11:29:23

Advertisements