Reputation: 4329
I'm using Bash on Ubuntu, and sometimes when I run a command, the output overfills the terminal, even when I scroll up to the top. How can I access the part of the output that's hidden because of the overfill?
Upvotes: 2
Views: 182
Reputation: 47267
You can try any of the following (Using the ls
command as an example for where the commands would go):
Option A: Redirect the output to a file with >
and then examine the file later with less
or a text editor like vim
or gedit
.
$ ls > outfile
$ less outfile
$ vim outfile
$ gedit outfile
$ emacs outfile
To write the command's output to both stdout and stderr to your outfile
, add a 2>&1
at the end, like so:
$ ls > outfile 2>&1
Option B: pipe the output of your command directly to less
$ ls | less
Note: if you view the output with less
with either of the above options, use:
Ctrl+F
to go down a page, Ctrl+B
to go up a page ,Ctrl+D
for down 1/2 a page, Ctrl+U
for up 1/2 a pageq
to exit from less
anytime.Upvotes: 3
Reputation: 881463
That's actually not bash
doing that, it's the terminal program.
You have a couple of options. Perhaps the easiest is just piping your command through less
, which allows you to scroll back and forth:
command_with_much_output | less
Secondly, you can configure your terminal program. Assuming you're using the default one, you can open up the Edit
menu and select Profile preferences
:
Then choose the Scrolling
tab and you can change the scrollback buffer size:
Upvotes: 1
Reputation: 69208
Or you can increase the number of lines kept to scrollback in profile's properties (assuming you are using gnome-terminal).
Upvotes: 0