Maybe it is rarely needed, but recently, I found it very useful to know how to record an interactive session, so I could reference to it later or just examine it further.
The whole process is very simple, as it requires only
script utlity from bsdutils package. This package is installed by default, so you can use it everywhere.
script utility will start an interactive shell defined using
SHELL variable and store operations in
$ script ~/console.log
--append argument to append output to the specified file instead of truncating it.
$ script -a ~/console.log
--flush argument to flush output after each write.
$ script -f -a ~/console.log
Store operations and replay them later
--timing argument to store timing data.
$ script -tconsole.timings console.commands
Replay operations using
$ scriptreplay console.timings console.commands
scriptreplay manual pages and documentation available in