I'm installing a package and get a load of errors and need to be able to read through all the error messages that come up. Unfortunately the terminal will only display a finite number of lines. How do I go about viewing previous lines or changing the maximum number of lines that can be displayed?
8 Answers
Like David Purdue suggests, I myself too. I like to have unlimited scrolling.

You can also enable the scrollbar if you want; but I prefer it disabled and use Shift + Page Up and Shift + Page Down keys to change the output frames.
If you are using the standard Terminal program on a Desktop version of Ubuntu...
Choose Edit -> Profile Preferences from the terminal windows global menu.
Choose the Scrolling tab
Set Scrollback to the desired number of lines (or check the Unlimited box).
Then you can use the scrollbar at the side of the terminal to scroll back through the lengthy command output.
- 2,517
Ubuntu 22.04
The default number of scroll back lines in Ubuntu 22.04 is 10000. You can change this to any number up to 2147483647 or disable it altogether. Both can be done either from the GUI or from the command line.
From the GUI
Open Terminal -> Settings (the hamburger button) -> Preference -> Profiles -> Unnamed -> Scrolling. There you will see Limit scrollback to. You can either disable it altogether or change the number of lines you want to scroll back like this:
From Command Line
The same thing can be done from the command line, using gsettings. Read more about how this works in this post: How to change gnome-terminal scrollback lines from command line.
Enable unlimited scrollback:
gsettings set org.gnome.Terminal.Legacy.Profile:/org/gnome/terminal/legacy/profiles:/:$(gsettings get org.gnome.Terminal.ProfilesList default | tr -d \')/ scrollback-unlimited true
Limit scrollback to 250,000 lines:
gsettings set org.gnome.Terminal.Legacy.Profile:/org/gnome/terminal/legacy/profiles:/:$(gsettings get org.gnome.Terminal.ProfilesList default | tr -d \')/ scrollback-lines 250000
- 4,379
You could start your command in a script session every action an command output would be saved without interfering with the execution unless |less or >file that forbid to have any interaction with the command.
$ script /tmp/command.out
Script started, file is /tmp/command.out
$ the_command
...
$ exit
Script done, file is /tmp/command.out
$ less /tmp/command.out
- 1,333
If you want to see the data and also run it to a file, use tee, e.g,
spark-shell | tee tmp.out
(spark-shell is just the example interactive program that you might want to capture output from.)
This will allow you to type commands in response to output from the program, but also capture the output to a file.
- 159
You could use | to output your command into more.
For example, if I wanted to read an entire text file that wouldn't fit on screen using cat, I would use:
cat /home/abcd/Downloads/fileName.txt | more
You can press enter to scroll down one line at a time, and q to exit. Press g to start over.
Hope this could be useful to you.
- 712
- 303
I recommend you to use output redirection. Type:
user@host:~# command >filename
Then you can read the file with a text editor for example less and browser through the output:
user@host:~# less filename
- 28,186
