script and scriptreplay are in util-linux.
Record and replay¶
script --timing=tutorial.timing tutorial.session # record; type 'exit' to stop
scriptreplay --timing=tutorial.timing tutorial.session
scriptreplay --maxdelay 1 --timing=tutorial.timing tutorial.session # cap long pauses at 1 second
scriptreplay --divisor 2 --timing=tutorial.timing tutorial.session # play at double speed
The older short form is script -t 2> tutorial.timing tutorial.session. Recording is a plain text file and may contain typed passwords and secrets. Review before sharing, and do not record while entering credentials. -a appends to an existing log. scriptlive (newer util-linux) replays a session into a live terminal.
Share terminal output live¶
With a named pipe:
# Viewer (user 2):
mkfifo /tmp/shared
cat /tmp/shared
# Sharer (user 1):
script -f /tmp/shared # -f flushes output after each write
Both users must be able to read/write the fifo. Compare tmate for a proper shared terminal, and asciinema for recordings you can play back in a browser.