Linux(Ubuntu) Terminal-how to view previous pages not visible anymore
LinuxTerminalLinux 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?