How do I increase the scrollback buffer in a running screen session?

前端 未结 6 628
没有蜡笔的小新
没有蜡笔的小新 2020-12-12 08:58

Lets say I have a currently running screen session I am interacting with through putty. I\'ve realized that the scrollback buffer is too small and would like to increase it

相关标签:
6条回答
  • 2020-12-12 09:05

    WARNING: setting this value too high may cause your system to experience a significant hiccup. The higher the value you set, the more virtual memory is allocated to the screen process when initiating the screen session. I set my ~/.screenrc to "defscrollback 123456789" and when I initiated a screen, my entire system froze up for a good 10 minutes before coming back to the point that I was able to kill the screen process (which was consuming 16.6GB of VIRT mem by then).

    0 讨论(0)
  • 2020-12-12 09:08

    The man page explains that you can enter command line mode in a running session by typing Ctrl+A, :, then issuing the scrollback <num> command.

    0 讨论(0)
  • 2020-12-12 09:12

    For posterity, this answer is incorrect as noted by Steven Lu. Leaving original text however.

    Original answer:

    To those arriving via web search (several years later)...

    When using screen, your scrollback buffer is a combination of both the screen scrollback buffer as the two previous answers have noted, as well as your putty scrollback buffer.

    Be sure that you are increasing BOTH the putty scrollback buffer as well as the screen scrollback buffer, else your putty window itself won't let you scroll back to see your screen's scrollback history (overcome by scrolling within screen with ctrl+a->ctrl+u)

    You can change your putty scrollback limit under the "Window" category in the settings. Exiting and reopening a putty session to your screen won't close your screen (assuming you just close the putty window and don't type exit), as the OP asked for.

    Hope that helps identify why increasing the screen's scrollback buffer doesn't solve someone's problem.

    0 讨论(0)
  • 2020-12-12 09:28

    Press Ctrl-a then : and then type

    scrollback 10000
    

    to get a 10000 line buffer, for example.

    You can also set the default number of scrollback lines by adding

    defscrollback 10000
    

    to your ~/.screenrc file.

    To scroll (if your terminal doesn't allow you to by default), press Ctrl-a ESC and then scroll (with the usual Ctrl-f for next page or Ctrl-a for previous page, or just with your mouse wheel / two-fingers). To exit the scrolling mode, just press ESC.

    Another tip: Ctrl-a i shows your current buffer setting.

    0 讨论(0)
  • 2020-12-12 09:29

    There is a minimal amount of "default" buffer when you startup a 'screen' session within your 'putty session'. I use screens a lot in my work, so I can tell you that you will not have a combination of 'screen' buffer & 'putty' buffer within your 'screen' session.

    Setting the default number of scrollback lines by adding defscrollback 10000 to your ~/.screenrc file is the correct solution.

    By the way, I use "defscrollback 200000" in my ./screenrc file.

    0 讨论(0)
  • 2020-12-12 09:31

    As Already mentioned we have two ways!

     Per screen (session) interactive setting

    And it's done interactively! And take effect immediately!

    CTRL + A followed by : And we type scrollback 1000000 And hit ENTER

    You detach from the screen and come back! It will be always the same.

    You open another new screen! And the value is reset again to default! So it's not a global setting!

     And the permanent default setting

    Which is done by adding defscrollback 1000000 to .screenrc (in home)

    defscrollback and not scrollback (def stand for default)

    What you need to know is if the file is not created ! You create it !

    > cd ~ && vim .screenrc
    

    And you add defscrollback 1000000 to it!

    Or in one command

    > echo "defscrollback 1000000" >> .screenrc
    

    (if not created already)

    Taking effect

    When you add the default to .screenrc! The already running screen at re-attach will not take effect! The .screenrc run at the screen creation! And it make sense! Just as with a normal console and shell launch!

    And all the new created screens will have the set value!

    Checking the screen effective buffer size

    To check type CTRL + A followed by i

    And The result will be as

    Importantly the buffer size is the number after the + sign
    (in the illustration i set it to 1 000 000)

    Note too that when you change it interactively! The effect is immediate and take over the default value!

    Scrolling

    CTRL+ A followed by ESC (to enter the copy mode).

    Then navigate with Up,Down or PgUp PgDown

    And ESC again to quit that mode.

    (Extra info: to copy hit ENTER to start selecting! Then ENTER again to copy! Simple and cool)

    Now the buffer is bigger!

    And that's sum it up for the important details!

    0 讨论(0)
提交回复
热议问题