平常记录终端里的一些命令log或操作记录等,script可以试试看:
script --help
Usage:
script [options] [file]
Make a typescript of a terminal session.
Options:
-a, --append append the output
-c, --command <command> run command rather than interactive shell
-e, --return return exit code of the child process
-f, --flush run flush after each write
--force use output file even when it is a link
-o, --output-limit <size> terminate if output files exceed size
-q, --quiet be quiet
-t[<file>], --timing[=<file>] output timing data to stderr or to FILE
-h, --help display this help
-V, --version display version
For more details see script(1).
记录log:
script -f note.log,输出到指定文件,可以边录log边看。-a则是追加记录到文件里。-t则是输出时序文件,适用于录过回放演示操作。
ex:script -f -t 2>time.log -a note.log

回放log:
scriptreplay --help
Usage:
scriptreplay [-t] timingfile [typescript] [divisor]
Play back terminal typescripts, using timing information.
Options:
-t, --timing <file> script timing output file
-s, --typescript <file> script terminal session output file
-d, --divisor <num> speed up or slow down execution with time divisor
-m, --maxdelay <num> wait at most this many seconds between updates
-h, --help display this help
-V, --version display version
For more details see scriptreplay(1).
ex:scriptreplay time.log note.log
终端会输出刚才的操作记录。
注意time.log不能少且要放在note.log前面。
退出
exit
Script done, file is note.log
PS:
还具有录制终端功能的tool:terminalizer
将录制的file做成gif文件:terminalizer、imagemagick(convert)
参考:
https://blog.youkuaiyun.com/ouyang_peng/article/details/78818492
https://blog.youkuaiyun.com/weixin_34293059/article/details/91715710