使用script命令于ubuntu中捕获终端数据输出

在ubuntu中需要捕获终端数据,欲保存运行命令及其执行过程输出信息时,可使用script命令。

man手册上的介绍如下:

DESCRIPTION
     script makes a typescript of everything printed on your terminal.  It is
     useful for students who need a hardcopy record of an interactive session
     as proof of an assignment, as the typescript file can be printed out
     later with lpr(1).


     If the argument file is given, script saves all dialogue in file.  If no
     file name is given, the typescript is saved in the file typescript.


另外,结合scriptreplay命令的使用,可实现终端操作的录制与回放。

例如: script -t 2>test.time -a test.log  完成录制

             scriptreplay test.time test.log    回放操作录像

你可能感兴趣的:(使用script命令于ubuntu中捕获终端数据输出)