如何增加正在运行的屏幕会话中的回滚缓冲区?
假设我当前正在运行一个 屏幕 会话,我正在通过 putty 与之交互。我意识到回滚缓冲区太小,并且希望在不启动新屏幕会话的情况下增加它。
有办法做到这一点吗?
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 without starting a new screen session.
Is there a way to do this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(6)
例如,按 Ctrl+A,然后按 :,然后键入
以获取 10000 行缓冲区。
来设置默认的回滚行数
您还可以通过添加到
~/.screenrc
文件。要滚动(如果您的终端默认不允许),请按 Ctrl+A,然后按 Esc,然后滚动(使用通常的方法) Ctrl+F 进入下一页或 Ctrl+A 进入上一页,或者仅使用你的鼠标滚轮/两根手指)。要退出滚动模式,只需按 Esc。
另一个提示:Ctrl+A 然后 i(小写)显示您当前的缓冲区设置。
Press Ctrl+A then : and then type
to get a 10000 line buffer, for example.
You can also set the default number of scrollback lines by adding
to your
~/.screenrc
file.To scroll (if your terminal doesn't allow you to by default), press Ctrl+A then 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 then i (lowercase) shows your current buffer setting.
手册页说明您可以通过键入 < 在运行会话中进入命令行模式kbd>Ctrl+A、:,然后发出
scrollback
命令。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.正如已经提到的,我们有两种方法。
每屏(会话)交互设置
交互设置,立即生效。
CTRL + A 后跟 : 然后我们输入
scrollback 1000000
并按 ENTER您从屏幕上分离并返回,它总是一样的。
您打开另一个新屏幕,该值将再次重置为默认值。所以这不是一个全局设置!
永久默认设置
是通过将
defscrollback 1000000
添加到.screenrc
(在 home 中)defscrollback
而不是scrollback< 来完成的/code> (def 代表默认值)
您需要知道的是,如果文件没有创建,您将创建它!
然后向其中添加
defscrollback 1000000
。或者在一个命令中
(如果尚未创建)
生效
当您将默认值添加到
.screenrc
时,重新附加时已运行的屏幕将不会生效!.screenrc
在屏幕创建时运行,这是有道理的!就像正常的控制台和 shell 启动一样。所有新创建的屏幕都将具有设置的值。
检查屏幕有效缓冲区大小
要检查,请输入 CTRL + A,然后输入 i
,结果将如下所示
重要的是缓冲区大小是+号后的数字
(在插图中,我将其设置为 1 000 000)
另请注意,当您以交互方式更改它时。效果是立即的并接管默认值。
滚动
CTRL+ A,然后滚动 ESC(进入复制模式)。
然后再次使用 Up、Down 或 PgUp PgDown
和 ESC 退出该操作模式。
(额外信息:要复制,请按ENTER开始选择,然后再次ENTER进行复制,简单而酷)
现在缓冲区更大了!
这就是重要细节的总结。
As Already mentioned we have two ways.
Per screen (session) interactive setting
And it's done interactively, and takes effect immediately.
CTRL + A followed by : And we type
scrollback 1000000
And hit ENTERYou 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 notscrollback
(def stand for default)What you need to know is if the file is not created, You create it !
And you add
defscrollback 1000000
to it.Or in one command
(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 makes sense! Just as with a normal console and shell launch.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.
当您在“putty 会话”内启动“屏幕”会话时,会有最少量的“默认”缓冲区。我在工作中经常使用屏幕,因此我可以告诉您,您不会同时使用“屏幕”缓冲区和“屏幕”缓冲区。 “屏幕”会话中的“putty”缓冲区。
通过添加 defscrollback 10000 设置默认的回滚行数
到您的
~/.screenrc
文件是正确的解决方案。顺便说一句,我在
./screenrc
文件中使用“defscrollback 200000”。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.我将 ~/.screenrc 设置为“defscrollback 123456789”,当我启动屏幕时,我的整个系统冻结了整整 10 分钟,然后才回到能够杀死屏幕进程的位置(该进程消耗了 16.6GB那时的 VIRT mem)。
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).
将 defscrollback 放在 ~/.screenrc 文件中打开其他窗口之前,例如
,否则,历史缓冲区中将只有 1024 行。
Put the defscrollback before additional windows are opened in your ~/.screenrc file, e.g.
Otherwise, you will have only 1024 lines in the history buffer.