Thomas' Tech Tips

Record terminal session using script

18 August 2023 - Thomas Damgaard

The script utility can be used to record a terminal session:

script -a ~/recording.script

Exit the shell to exit the recording.

The recording is a text file that contains control sequences. Use cat -v or less -R to view them.

Optionally, you can create a timing file that will allow you to replay the recording in the terminal.

Use the -t option to create the timing file:

script -t 2>~/recording.time -a ~/recording.script

This command will start recording the session and save the output to recording.script. The -t option is used to specify the timing file, which will be saved as recording.time.

In order to replay the recorded session, use scriptreplay:

scriptreplay recording.time recording.script
Filed under: howto, linux, script, shell, tips

Back to article list