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?

  • 2
    See if your terminal has something to increase or decrease scrollback lines. – user25656 Dec 4 '13 at 12:04

Use less:

your_command | less 

Your Enter key will take you down.

Also, press q to exit.

  • 1
    do you mean "yourcommand | less" ? – MycrofD Jul 8 '15 at 13:11

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.

  • Where to do this in Ubuntu 15.04? the profile preferences are not visible anywhere. – MycrofD Jul 8 '15 at 13:09
  • sorry @MycrofD can't say about that, have not tried 1504.. you should check the script command and see if it fits to your needs. This was one of the adviced ones on my simillar post for TTY console terminal askubuntu.com/questions/487133/… – precise Jul 14 '15 at 7:52
  • I tried both checking "unlimited" and setting the scrolling to 4096 lines. Neither works; the terminal insists on showing only 30 lines. I'm well aware of redirection, and Vim seems to do the right thing, but sometimes I just want to scroll. What could I be missing? – Paul Brinkley Oct 31 '16 at 16:53
  • Is there a way to do it in the terminal? I want to do it on a Docker container and creating new files is unsupported on the Docker image I'm using so being able to scroll up farther instead of dumping the terminal output to a file would be beneficial. – AndreasKralj Feb 5 '19 at 17:13

If you are using the standard Terminal program on a Desktop version of Ubuntu...

  1. Choose Edit -> Profile Preferences from the terminal windows global menu.

  2. Choose the Scrolling tab

  3. 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
    Where is Edit -> Profile ? – gfan Sep 11 '18 at 9:19
  • It is in the menu bar for the Terminal program. This usually appears at the top of the screen when Terminal has focus, but you may have to move your mouse to the top of the screen for it to appear. – David Purdue Dec 17 '18 at 10:34

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

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.


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

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.