scriptreplay
Replay terminal sessions recorded by 'script'
TLDR
Replay a typescript at the speed it was recorded
Replay a typescript at double the original speed
Replay a typescript at half the original speed
SYNOPSIS
scriptreplay [options] [typescript_file [timing_file]]
Commonly: scriptreplay [-d delay] [-m multiplier] [-s typescript_file] [-t timing_file]
PARAMETERS
-d
Add a fixed delay (in seconds) to each pause during playback. This can slow down or speed up the replay.
-m
Multiply all recorded delays by multiplier. A value of 0.5 plays back at half speed, 2.0 at double speed.
-s
Specify the typescript file containing the recorded session output. Defaults to typescript.
-t
Specify the timing file containing the timestamp information. Defaults to timing.
The positional argument for the typescript file. If -s is not used, this is the first argument. Defaults to typescript.
The positional argument for the timing file. If -t is not used, this is the second argument. Defaults to timing.
--help
Display help message and exit.
--version
Output version information and exit.
DESCRIPTION
scriptreplay is a powerful utility used to replay a terminal session that was previously recorded using the script command. It is particularly useful for demonstrations, tutorials, or debugging by allowing users to accurately reproduce the exact output and timing of a past interactive session. For scriptreplay to work effectively, the script command must have been invoked with the -t or --timing option to capture timing information alongside the standard output. This timing data, typically stored in a separate file, dictates how fast or slow the output is displayed during playback, mimicking the original user's typing speed and command execution delays. scriptreplay leverages the pv (Pipe Viewer) utility to control the speed of output, ensuring a faithful reproduction of the original session's rhythm. By default, it expects a file named typescript for the recorded session and timing for the timing information, but these can be specified explicitly.
CAVEATS
scriptreplay relies on pv (Pipe Viewer) being installed and available in the system's PATH for accurate timing control. If pv is not found, playback might occur at maximum speed without respecting delays.
Playback accuracy is directly dependent on the integrity and correctness of the timing file. Corrupted or incomplete timing data can lead to erratic replay behavior.
It re-displays output only; it does not re-execute commands. The interactive nature of the original session is simulated, not replicated.
Terminal size changes during the original recording might lead to visual inconsistencies during playback, as scriptreplay does not automatically adjust the terminal size.
ANSI escape codes and complex terminal applications might not always render identically across different terminal emulators or versions.
RECORDING AND REPLAYING A SESSION
To use scriptreplay, first record a session with timing data. For example:
script -t 2>timing.log my_session.log
Perform your commands, then exit.
To replay the session, use:
scriptreplay timing.log my_session.log
Or, explicitly specifying files:
scriptreplay --timing timing.log --typescript my_session.log
If you use default names (typescript and timing), you can simply run scriptreplay after script -t.
HISTORY
scriptreplay is part of the util-linux project, a collection of essential Linux utilities. Its development is closely tied to the script command. Initially, script only captured the standard output. However, the need to faithfully reproduce the timing and flow of a session led to the addition of the -t (or --timing) option in script, which captures timing metadata. This enhancement made scriptreplay a vital companion tool, allowing for precise re-enactment of recorded sessions for educational, diagnostic, or demonstration purposes. Its integration with pv further solidified its capability to accurately reflect real-world user interaction speeds.