Sometimes when it’s useful to record a console session (either to look at it later or do distribute it), I use
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
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
Both tools are available in the package