script 命令制作显示在终端上的所有内容的 typescript。将 typescript 写到 File 参数指定的文件中。随后可将 typescript 发送到行式打印机。如果没有给定文件名,就会将 typescript 以文件名 typescript 保存在当前目录中。
# script -a output.log
-a
将 typescript 附加到指定的文件或 typescript 文件。
更多参考:
man script
可惜 script 有个BUG。 当用户操作vi等,文件log里会有很多不可见字符。