Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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.

share|improve this question
How would such a system recognise commands where this should not be done? E.g. console Vim, nano, mutt, less, top – daniel kullmann Oct 8 '12 at 11:25
Why not just set your terminal emulator to unlimited scrollback? – jgoldschrafe Oct 8 '12 at 13:25
@jgoldschrafe I've done that before, and it ended up filling up RAM. – l0b0 Oct 8 '12 at 13:42

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).

share|improve this answer
+1 for GNU Screen. I also suggest Byobu (wrapper around Tmux/Screen) and its convenient F7-button to let it behave like a pager. – gertvdijk Dec 8 '12 at 0:19

I don't know if that's possible.

The next best thing may be piping things to less -FX. The -F flag will make less quit immediately if the entire input fits on one screen, and the -X will make it not clear the screen after you exit.

share|improve this answer

script is a round about way to doing just that. From the man page:

 script makes a typescript of everything printed on your terminal.  It is
 useful for students who need a hardcopy record of an interactive session
 as proof of an assignment, as the typescript file can be printed out
 later with lpr(1).
share|improve this answer
Close, but that doesn't actually provide a pager, which is much more handy than a separate text file, especially when running many terminals. – l0b0 Aug 9 '12 at 7:56
@l0b0: Indeed this is why I said round about way... – Sardathrion Aug 9 '12 at 9:56

Konsole can suspend output with CTRL + S, all buffer in current window are freezed and able to use PageUp or PageDown to navigate.

But you need to increase buffer if necessary:

enter image description here

share|improve this answer
Method A is exactly what I want to avoid - Adding a pager command manually to every command. Method B won't work if the command produces output quickly - By the time I click Ctrl-S (which works in other terminals as well, by the way) output has already been lost from the terminal buffer. – l0b0 Oct 8 '12 at 13:51
@l0b0 you can increase the buffer length to i.e 5000 lines – warl0ck Oct 8 '12 at 14:25

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.