Linux(Ubuntu) Terminal-how to view previous pages not visible anymore

LinuxTerminal

Linux Problem Overview


When you scroll up, say to see a log, the first portion of it will not be visible since the terminal only supports a limited no. of lines. So if you want to scroll up and be able to see everything, at least a few pages up, how do you do it?

Linux Solutions


Solution 1 - Linux

Use Shift+Page Up and Shift+Page Down.

Solution 2 - Linux

Piping the output to a pager like the following is a better choice:

command | less 

command | more

Solution 3 - Linux

You can enable unlimited scroll back (or a huge amount if you want).

To do this, go to

> File → Profile preferences → Scrolling [tab]

Then, check Unlimited, or set the number of lines desired. And of course, it only applies to the next typed lines.

Solution 4 - Linux

Some tricks I use-

some terminal applications (gnome-terminal) allow you to increase the scroll-back buffer size

pipe output to a file:

command > file.log

pipe your command to less:

command | less

tail log and pipe to grep to reduce output

tail -f example.log | grep 'search text'

Solution 5 - Linux

An alternative to screen is using tee to copy all output to a file while still printing it on the terminal:

yourcommand | tee output.txt

Solution 6 - Linux

Try using the screen command, and set its scrollback buffer to a larger size.

screen has many other benefits and wonderful features.

If all you're doing is looking at a log, you could alternately use a pager such as less

Solution 7 - Linux

If you want to scroll line by line, you can use

>Control+Shift+Up/Down Arrows.

Solution 8 - Linux

If you are using gnome-term (the default), then you can change your settings. Either set the no. of lines to unlimited, or to a much larger buffer size than the default.

Solution 9 - Linux

Essentially seconding to @zerick's solution but if you're on gnome-terminal you can modify its config. See this.

Solution 10 - Linux

If you are in tmux (can create multiple terminal sessions in a single terminal session, highly recommended), you can easily use your normal navigation keys to scroll around after you do Ctrl-b then [, for more details let's take a look at: How do I scroll in tmux?

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionNamrathaView Question on Stackoverflow
Solution 1 - LinuxDr. SnoopyView Answer on Stackoverflow
Solution 2 - LinuxthegeekView Answer on Stackoverflow
Solution 3 - LinuxzerickView Answer on Stackoverflow
Solution 4 - Linuxuser385772View Answer on Stackoverflow
Solution 5 - LinuxtobiwView Answer on Stackoverflow
Solution 6 - LinuxBorealidView Answer on Stackoverflow
Solution 7 - LinuxRadioactiveView Answer on Stackoverflow
Solution 8 - LinuxzdavView Answer on Stackoverflow
Solution 9 - LinuxIsaacSView Answer on Stackoverflow
Solution 10 - LinuxZhiweiView Answer on Stackoverflow