Using Ubuntu 22.04. I want to change gnome-terminal
scrollback lines from the command line.
I know it's possible to do it from Terminal -> Settings (the hamburger button) -> Preference -> Profiles -> Unnamed -> Scrolling, like this:
I want to be able to do the same, but from the command line. I am looking for a solution that will work in sync with the GUI option, not overwride it. The idea is that if after some time I forget I set the option from CLI , I should be able to change its value from Preference -> Profiles -> Unnamed -> Scrolling.
This can be done with
gsettings
.Limit scrollback to 250,000 lines:
The maximum
scrollback-lines
value is2147483647
, and the default is10000
.Enable unlimited scrollback:
How it works:
We are using
org.gnome.Terminal.Legacy.Profile
asSCHEMA
.The
:PATH
we need is/org/gnome/terminal/legacy/profiles:/:[target-profile-id]/
where[target-profile-id]
is the id of the profile we are editing. The commandgsettings get org.gnome.Terminal.ProfilesList default
gets the id of the default profile andtr -d \'
removes the'
from the response.To change terminal scrollback lines, the
KEY
isscrollback-lines
and we set itsVALUE
to250000
, which is the number of lines we want to be able to scroll back. Depending on whether we want to enable or disable the unlimited scrollback, we usescrollback-unlimited
asKEY
withtrue
orfalse
asVALUE
.Related:
If you are worried about resource usage, check this post: Gnome terminal scrollback lines?