首页 > 代码库 > Linux Cmd Tool 系列之—script & scriptreplay
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
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。