Linux 如何在正在运行的屏幕会话中增加回滚缓冲区?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/8760346/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How do I increase the scrollback buffer in a running screen session?
提问by Zach
Lets say I have a currently running screensession I am interacting with through putty. I've realized that the scrollback buffer is too small and would like to increase it withoutstarting a new screen session.
假设我有一个当前正在运行的屏幕会话,我正在通过腻子与之交互。我已经意识到回滚缓冲区太小,希望在不启动新屏幕会话的情况下增加它。
Is there a way to do this?
有没有办法做到这一点?
采纳答案by Frédéric Hamidi
回答by Lee Netherton
Press Ctrl-athen :and then type
按Ctrl-a然后:然后键入
scrollback 10000
to get a 10000 line buffer, for example.
例如,获取 10000 行缓冲区。
You can also set the default number of scrollback lines by adding
您还可以通过添加设置默认的回滚行数
defscrollback 10000
to your ~/.screenrc
file.
到您的~/.screenrc
文件。
To scroll (if your terminal doesn't allow you to by default), press Ctrl-aESCand then scroll (with the usual Ctrl-ffor next page or Ctrl-afor previous page, or just with your mouse wheel / two-fingers). To exit the scrolling mode, just press ESC.
要滚动(如果您的终端默认不允许您这样做),请按Ctrl-aESC然后滚动(通常Ctrl-f用于下一页或Ctrl-a上一页,或仅使用鼠标滚轮/两指)。要退出滚动模式,只需按ESC。
Another tip: Ctrl-aishows your current buffer setting.
另一个提示:Ctrl-ai显示您当前的缓冲区设置。
回答by Brad P.
For posterity, this answer is incorrect as noted by Steven Lu. Leaving original text however.
对于后人,正如 Steven Lu 所指出的那样,这个答案是不正确的。然而留下原文。
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.
使用屏幕时,您的回滚缓冲区是screen
前两个答案所指出的回滚缓冲区以及您的腻子回滚缓冲区的组合。
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
)
确保您同时增加了腻子回滚缓冲区和屏幕回滚缓冲区,否则您的腻子窗口本身不会让您回滚以查看您screen
的回滚历史记录(通过在屏幕内使用 滚动来克服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.
您可以在设置中的“窗口”类别下更改腻子回滚限制。退出并重新打开一个腻子会话到您的屏幕不会关闭您的屏幕(假设您只是关闭腻子窗口并且不键入exit
),正如 OP 所要求的那样。
Hope that helps identify why increasing the screen's scrollback buffer doesn't solve someone's problem.
希望这有助于确定为什么增加屏幕的回滚缓冲区不能解决某人的问题。
回答by Oracle DBA 2000 b.c.
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.
通过添加defscrollback 10000
到~/.screenrc
文件来设置默认回滚行数是正确的解决方案。
By the way, I use "defscrollback 200000" in my ./screenrc
file.
顺便说一下,我在我的./screenrc
文件中使用了“defscrollback 200000” 。
回答by 1GLENCo
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).
警告:将此值设置得太高可能会导致您的系统出现严重故障。您设置的值越高,在启动屏幕会话时分配给屏幕进程的虚拟内存就越多。我将 ~/.screenrc 设置为“defscrollback 123456789”,当我启动一个屏幕时,我的整个系统冻结了 10 分钟,然后又回到了我能够杀死屏幕进程(消耗 16.6GB)的地步那时的 VIRT 内存)。
回答by Mohamed Allal
As Already mentioned we have two ways!
正如已经提到的,我们有两种方法!
?Per screen (session) interactive setting
?每屏(会话)交互设置
And it's done interactively! And take effect immediately!
它是交互式完成的!并立即生效!
CTRL + Afollowed by :And we type scrollback 1000000
And hit ENTER
CTRL + A然后:我们输入scrollback 1000000
And hitENTER
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 1000000
到.screenrc
(在家里)
defscrollback
and not scrollback
(def stand for default)
defscrollback
而不是scrollback
(def代表默认)
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!
你添加defscrollback 1000000
它!
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!
当您将默认值添加到.screenrc
! 重新连接时已经运行的屏幕将不会生效!该.screenrc
屏幕创建运行!这是有道理的!就像普通的控制台和 shell 启动一样!
And all the new created screens will have the set value!
并且所有新创建的屏幕都将具有设置值!
Checking the screen effective buffer size
检查屏幕有效缓冲区大小
To check type CTRL + Afollowed by i
检查类型CTRL + A后跟i
And The result will be as
结果将是
Importantly the buffer sizeis the number after the + sign
(in the illustration i set it to 1 000 000)
重要的是缓冲区大小是+号后面的数字
(在插图中我将其设置为 1 000 000)
Note too that when you change it interactively! The effect is immediate and take over the default value!
还要注意,当您以交互方式更改它时!效果立竿见影,接管默认值!
Scrolling
滚动
CTRL+ Afollowed by ESC(to enter the copy mode).
CTRL+ A后跟ESC(进入复印模式)。
Then navigate with Up,Downor PgUpPgDown
然后使用Up,Down或PgUpPgDown
And ESCagain to quit that mode.
并ESC再次退出该模式。
(Extra info: to copy hit ENTERto start selecting! Then ENTERagain to copy! Simple and cool)
(额外信息:复制点击ENTER开始选择!然后ENTER再次复制!简单而酷)
Now the buffer is bigger!
现在缓冲区更大了!
And that's sum it up for the important details!
这就是重要细节的总结!