我们希望保存在跨越多行的Linux控制台上运行的程序的输出。 不幸的是,它没有被logging或在屏幕下运行,或任何其他方式,让我们轻松捕捉输出。 到目前为止,我们能够提出的最好的方法是:
Log into the machine via a separate SSH session In the console session, page to the top of the buffer Repeat: In the SSH session, run "cat /dev/vcs >> screendump.txt" In the console session, page down one screen Dump the final screen in the SSH session
有没有更好的办法? 看起来,如果VC内存是连续的,你知道你可以使用dd将控制台文本直接从内核内存中拖出来并存入文件。
setterm可以转储Linux虚拟控制台的内容:
setterm -file log.txt -dump [ttynumbers]
但是,它不能访问回滚缓冲区,只能访问当前显示的内容。
除非VGACON_SOFT_SCROLLBACK设置为“Y”,否则VGACON_SOFT_SCROLLBACK缓冲区位于VGA存储器而不是系统内存。