将屏幕复制到文件(capture 和 script 命令)
使用模拟 VT100 终端的 capture 命令将终端上打印的所有内容复制到您指定的文件。 使用 script 命令将终端上打印的所有内容复制到您指定的文件中,而不仿真 VT100 终端。
这两个命令对打印终端对话框的记录都是相当有用的。
例如,要在模拟 VT100 的情况下捕获终端屏幕,请在提示符处输入以下命令:
capture screen.01系统显示与以下类似的信息:
Capture command is started. The file is screen.01.
Use ^P to dump screen to file screen.01.
You are now emulating a vt100 terminal.
Press Any Key to continue.输入数据并转储屏幕内容后,通过按 Ctrl-D 或输入 exit 并按 Enter 键来停止 capture 命令。 系统显示与以下类似的信息:
Capture command is complete. The file is screen.01.
You are NO LONGER emulating a vt100 terminal.使用 cat 命令来显示文件内容。
例如,要捕获终端屏幕,请在提示符处输入以下命令:
script系统显示与以下类似的信息:
Script command is started. The file is typescript.屏幕上的所有显示现在被复制到 typescript 文件。
要停止 script 命令,按下 Ctrl-D 或者输入 exit 并按 Enter 键。 系统显示与以下类似的信息:
Script command is complete. The file is typescript.使用 cat 命令来显示文件内容。