Linux Cmd Tool 系列之—script & scriptreplay

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Linux Cmd Tool 系列之—script & scriptreplay相关的知识,希望对你有一定的参考价值。

Intro

Sometime we want to record cmd and outputs in the interactive shell sessions. However history cmd cannot do this. So we need cmd line recording tool like script and scriptreplay.

References

Master‘s Shoulder:How to Record and Replay Linux Terminal Sessions using ‘script’ and ‘scriptreplay’ Commands

Key Points

script cmdhist.log

This starts the script recording process, which underlyingly is spawning a new shell, all successive cmds you type is in the new shell.

exit

This exits the new shell created by script cmd.

script --timing=time.log cmdhist.log

This will populate another time.log file that keeps the timestamp of each historical cmd step. 

To replay such cmdhist.log, you need time.log and scriptreplay cmd.

scriptreplay --timing=time.txt script.log

 

以上是关于Linux Cmd Tool 系列之—script & scriptreplay的主要内容,如果未能解决你的问题,请参考以下文章

Linux Cmd Tool 系列01—alias

Git ——Tool

跟我学CMD实战系列之二 ——数据压缩备份

Html5NodeJs安装less之千辛万苦CMD系列

Linux之轨迹记录(script)

初学python之day9