Possible Duplicate:
How do I ensure that a terminal remains scrollable?

I've configured really sweet keystrokes for switching between, and scrolling in, a tty (the Linux console). But, as soon as I change from one tty to another (or, from X to a tty), I cannot scroll anymore!

But, scrolling still "works", since, if I enter a new command, I can scroll that output (in addition to the output not "lost" when I returned to the tty, i.e., what was left on the screen when I changed in the first place).

marked as duplicate by Mikel, jasonwryan, manatwork, Renan, rahmu Nov 9 '12 at 17:11

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • 2
    +1 One of the most annoying limitations of Linux VTs (I'm not aware of any way to avoid it) and another good reason to use GNU screen or equivalent. – Stéphane Chazelas Nov 8 '12 at 21:56
  • @StephaneChazelas: Do you know where the history is stored? Is this in a file or a data structure? Maybe I could bind some save-and-store scheme to my "switch tty" shortcuts... But, got it to work with screen, thanks. – Emanuel Berg Nov 8 '12 at 23:45
  • 1
    VGA (-compatible) cards can have several "pages" if you aren't using the card at its full resolution. Scrolled-out text is just stored there, in the video memory's free pages. It is of course wiped out when you switch to another terminal, or else you would have the incorrect scrollback. – angus Nov 9 '12 at 0:46
  • 1
    FreeBSD doesn't have this problem, each VT has it's own scrollback buffer I am guessing. – Marcin Nov 9 '12 at 16:57
  • @angus: Interesting. Check out my comment to Jim Paris' answer below. – Emanuel Berg Nov 9 '12 at 19:42

Not possible, sorry. Both the vgacon and fbcon drivers in the Linux kernel will clear scrollback data when con_switch is called. See drivers/video/console/fbcon.c:fbcon_switch, for example:

scrollback_max = 0;
scrollback_current = 0;
  • Yes, scrollback data is cleared, that much is... clear. Do you know, is the data stored in a kernel data structure? Could it be saved to a file, and then restored, in much the same way as the context switch of multiprocessing? – Emanuel Berg Nov 9 '12 at 19:41
  • 1
    The kernel could do that, yes, but it doesn't, nor does it provide any way for you to get at that data from outside the kernel. You could change the kernel, of course. – Jim Paris Nov 9 '12 at 20:45
  • 1
    Apparently somebody wrote a patch for that, but it wasn't accepted. So, AFAIK, the kernel still only preserves the visible console area. – angus Nov 9 '12 at 21:14
  • Well, there you go, apply that patch and you're all set :) – Jim Paris Nov 9 '12 at 22:04

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