scriptreplay

Replay a previously recorded terminal session using timing data from script.

Category: System terminal logging replay util-linux

Install

# Usually part of util-linux

# RHEL / Alma / Rocky
sudo dnf install util-linux

# Debian / Ubuntu
sudo apt install util-linux

# openSUSE
sudo zypper install util-linux

# Arch
sudo pacman -S util-linux

What it does

scriptreplay replays a terminal session that was recorded with the script command using a timing file. It reproduces the output at approximately the same speed as the original session.

How it works (mechanical)

  • Reads a timing file created with script -t.
  • Reads the corresponding session log file.
  • Replays output with original timing intervals.
  • Does not re-execute commands — only replays recorded output.
  • Speed can be adjusted with scaling options.

Quick Start

# Record a session with timing
script -t timing.log session.log

# Replay it
scriptreplay timing.log session.log

10 Practical Examples

# 1) Basic replay
scriptreplay timing.log session.log
# 2) Speed up replay (2x)
scriptreplay -d 0.5 timing.log session.log
# 3) Slow down replay (half speed)
scriptreplay -d 2 timing.log session.log
# 4) Record with timing in one step
script -t timing.log demo.log
# 5) Replay for training demonstration
scriptreplay timing.log demo.log
# 6) Inspect timing file
less timing.log
# 7) Inspect session output file
less demo.log
# 8) Combine with script for troubleshooting documentation
script -t issue.time issue.log
# 9) Replay with different speed multiplier
scriptreplay -m 2 timing.log session.log
# 10) Verify terminal type before recording
echo $TERM

Notes & Gotchas

  • Requires timing file created with script -t.
  • Does not simulate user input — only output timing.
  • Control characters are replayed as recorded.
  • Terminal size differences may affect display.
  • Useful for training, demos, and troubleshooting reproduction.

Historical Context

scriptreplay was introduced to complement script, allowing administrators and trainers to replay sessions realistically before screen recording tools became common.

Modern Equivalent

While graphical screen recording tools exist, scriptreplay remains lightweight and text-focused. It is especially useful in SSH-only or server environments without graphical interfaces.

Related Commands

  • script — record terminal sessions.
  • tty — show current terminal device.
  • less — inspect recorded output files.
  • history — show shell command history.
  • tee — duplicate output to file and screen.