Bash – How to send all output to a pager by default

bashgnome-terminalpager

git has a very nice feature for many of its commands: The output on an interactive terminal is passed to a pager by default, in such a way that it only keeps the pager open if there's more than one screenful of output, and it leaves the output on the terminal instead of clearing it when you exit. Is there some way to configure this to be the default for Bash in GNOME Terminal? That is, to send all TTY output (ideally including standard error) of every command to a pager.

The idea is that sometimes commands unexpectedly produce tons of output (especially in case of syntax or other errors), and some of that might even be lost because of the history settings of the terminal. It would be better to get half a chance to know what actually happened by seeing the output in a pager.

Best Answer

I don't know if it is possible. But...

a couple of workaround are there:

  • in gnome-terminal you can see previous pages with Shift-PgUp / Shift-PgDn

  • if you use screen, you can see previous pages entering copy mode with Ctrl-a Esc, then moving around with PgUp, PgDn and other vi commands (to exit from copy mode, Esc).

Related Question