Sometimes when it’s useful to record a console session (either to look at it later or do distribute it), I use script and scriptreplay.

script will record a terminal session into a file and scriptreplay can replay the whole session, whithout actually changing anything.

Record a session

A sessions contains the actual console content as well as the timing information in order to replay it. You can perfectly fine do without the timint information, but then you will not be able to replay it. Just to look at a static text file.

# Without timing information
$ session session.log

# With the timing information
$ session --timing time.txt session.log

Running one of those in the console with start a process in the background that logs the current output into the file session.log.

You end the session by either typing exit or using CTRL+D. Even if usually your terminal might close when typing exit, running the recording will not close the console, but end the recording.

Replay a session

Replaying the session, if timing information is available, can be done using scriptreplay:

$ scriptreplay --timing time.txt session.log

There are some parameters available which can influence the speed of the replay. Check the MAN page for those (script, scriptreplay

Both tools are available in the package util-linux.