我们想保存在跨越多行的 Linux 控制台上运行的程序的输出。不幸的是,它没有被记录或在屏幕下运行,或任何其他让我们轻松捕获输出的方式。到目前为止,我们能够想出的最佳方法是:
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
Run Code Online (Sandbox Code Playgroud)
有没有更好的办法?似乎如果 VC 内存是连续的,并且您知道它在哪里,您可以dd
将控制台文本直接从内核内存中提取出来并放入文件中。