How to see more lines in the terminal

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?

1

7 Answers

Like David Purdue suggests, I myself too. I like to have unlimited scrolling.

editTerminalProfile

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.

5

Use less:

your_command | less 

Your Enter key will take you down.

Also, press q to exit.

1

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

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.

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
2

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

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

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

You Might Also Like