📜 ⬆️ ⬇️

Console screencast

It turns out that recording work sessions in the terminal is quite simple. The script program included in the util-linux-ng package can write all your actions to a file. In the output file (by default it is called “typescript”), the full log of your work behind the terminal is stored, including the console output. You can use it for different purposes, starting with recording student labs and ending with tracking who and what did your terminal.

But the most interesting thing is the possibility of later playing this log in real time using a perl-script called scriptreplay
This is done like this:

> script -t 2>replayfile
> #
> Ctrl^D
> scriptreplay ./replayfile


The -t option displays the timeline of the recording in stderr, which is redirected to a separate file used by the script replay. By default, scriptreplay reads the “typescript” file and plays it in real time. Of course, this can be changed by specifying a different file and a different timeline. For example:
')
> script -t 2>replayfile my_typescript
> scriptreplay ./replayfile ./my_typescript 3


The number 3 means in this case that the actions will be played 3 times faster.

In the same way, you can record sessions with the participation of console pseudo-graphic applications - this is especially useful if you perform certain critical actions in them (for example, you work with the cfdisk disk partitioning utility) and you need to conduct a subsequent debriefing or a master class. Another use case is creating tutorials (a great way to show everyone your masterly handling of vim and mc)

PS Small problem: a session with pseudographics recorded in one resolution of the terminal will not play correctly on another resolution.

Source: https://habr.com/ru/post/49385/


All Articles