How to increase the scrollback buffer size for tty

5,813

Solution 1

As it turns out I did not have any framebuffer active on my machine (there was no device under /dev/fb0), so I tryied to mount a driver for a framebuffer.

I got a working framebuffer installing the v86d emulator (which is required by uvesafb framebuffer driver) then enabling the uvesafb driver with modprobe uvesafb.

At this point when I had a framebuffer at /dev/fb0 I noticed that the scrollback range increased.

In order to have changes permanent at boot time I did the following:

  • created a new configuration file under /etc/modules-load.d/uvesafb.conf containing the string uvesafb. This module will be loaded at boot time from now on.

  • edited the grub configuration file located at /etc/default/grub and added fbcon=scrollback:1024k to the GRUB_CMDLINE_LINUX_DEFAULT option then a update-grub. Later I noticed that a 1024KB scrollback buffer was not enough for my needs and I increased it to 4096KB.

Solution 2

Many command-line programs write to standard output, which means you can do something like this to log the output:

apt search browser >> ~/my-log.log

But, a more transparent approach is to use the logging capabilities of a terminal multiplexor.

For example, with tmux you can do the following:

  1. From a terminal run tmux, which will produce a new shell within the utility.
  2. Assuming tmux default keyboard bindings, press CTRL-b, then SHIFT: (hold SHIFT and press colon). That will put you in tmux's command mode.
  3. Type pipe-pane -o 'cat >> ~/my-log.log' and press ENTER.
  4. Run whatever commands you want within that tmux pane; they'll get logged to ~/my-log.log.
Share:
5,813

Related videos on Youtube

dasj19
Author by

dasj19

Updated on September 18, 2022

Comments

  • dasj19
    dasj19 over 1 year

    I have a fresh debian jessie server installed in a virtual machine and I want to be able to scroll back with Shift+PageUp and see the full long output of commands like "apt search browser". At the moment I can only see about 5 pages worth of scrolling.

    I tryied the following to increase the scrollback buffer size:

    UPDATE: I found out that I have no framebuffer enabled (there is not /dev/fb0 available) ... now I try to figure out how to enable it

    • dasj19
      dasj19 over 7 years
      @switch87 what do you mean with updates? I have a fresh system and I am trying to increase the buffer so I can scroll longer upwards by pressing Shift+PageUp several times
  • dasj19
    dasj19 over 7 years
    thanks for this workaround, I could also use the less command but I am not looking for a workaround, I want to be able to scroll through the output
  • Emmanuel Rosa
    Emmanuel Rosa over 7 years
    With tmux you can adjust the size of a pane's buffer, allowing you to scroll back. This is separate from the logging I mentioned. See stackoverflow.com/questions/18760281/…
  • dasj19
    dasj19 almost 4 years
    hi @Atralb , I spawned an arch virtual machine and things are much more easier than the way I did it on debian. You need to do only the last part with grub editing. Which in Arch is like this: nano /etc/default/grub edit like I describe above, then grub.mkconfig -o /boot/grub/grub.cfg. Use 4096k to have a really long scrollback, default is only 32k according to Arch Wiki. wiki.archlinux.org/index.php/Linux_console