How to increase the scrollback buffer size for tty
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 stringuvesafb
. This module will be loaded at boot time from now on.edited the grub configuration file located at
/etc/default/grub
and addedfbcon=scrollback:1024k
to theGRUB_CMDLINE_LINUX_DEFAULT
option then aupdate-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:
- From a terminal run
tmux
, which will produce a new shell within the utility. - Assuming tmux default keyboard bindings, press
CTRL-b
, thenSHIFT:
(hold SHIFT and press colon). That will put you in tmux's command mode. - Type
pipe-pane -o 'cat >> ~/my-log.log'
and pressENTER
. - Run whatever commands you want within that tmux pane; they'll get logged to
~/my-log.log
.
Related videos on Youtube
dasj19
Updated on September 18, 2022Comments
-
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:
- Adding
fbcon=scrollback:1024k
toGRUB_CMDLINE_LINUX_DEFAULT
andGRUB_CMDLINE_LINUX
in/etc/default/grub
then doing aupdate-grub
, as explained here: https://askubuntu.com/questions/709697/how-to-increase-scrollback-lines-in-ubuntu14-04-2-server-edition and https://askubuntu.com/questions/790804/how-to-set-unlimited-scrolling-on-a-tty ; However after updating the grub and rebooting the scrollback buffer has the same size. What else should I do to be able to scrollback longer?
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 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
- Adding
-
dasj19 over 7 yearsthanks 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 over 7 yearsWith 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 almost 4 yearshi @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, thengrub.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