Replaying terminal sessions with scriptreplay

OK, this is so cool and sexy, I really don't understand how I didn't find about this earlier. Possibly because it's the recent add-on to the well known script utility?

So, I suppose you all know about script. You type script, do your work, type exit, and you have your complete session logged in the file named typescript. Quite handy if you want to log everything you did in the shell for whatever reasons.

What you might not know is that script has an interesting switch which allows you to also save the exact timing data of the screen output you're capturing. And an additional utility called scriptreplay which can later replay your session in real-time. Like a movie. With perfect timing.

It works like this:

% script -t 2> demo.timing -a demo.session
Script started, file is demo.session
% <do something>
% exit
Script done, file is demo.session

And later you replay your session like this:

% scriptreplay demo.timing demo.session

This looks like a perfect tool for short tutorials of things that need to be done in the shell prompt. To check this fact, I've attached session of a small tutorial, how to enable process accounting in Ubuntu, find it attached below (only 2KB download). Unpack it and run like this:

% tar xvzf acct-scriptreplay.tgz
% scriptreplay acct.timing acct.session

What do you think? Is it useful?

File acct-scriptreplay.tgz2 KB


Fantastic, although script was installed in my system, but I never discover that until I read your post. Thanks.

Yeah, my sentiments exactly. :) Looking at my /usr:

% du -sm /usr
4265 /usr

Oops, soon it will not fit onto one DVD media.
God knows what other useful software lurks in there. :)

That happened for me also. this was really helpful.

You can even "share" your bash session by using a FIFO file

On the same machine :

user 1 :
$ mkfifo /tmp/file

user 2 :
$ cat /tmp/file

user 1 :
$ script -f /tmp/file

Now, everything done by user 1 in the terminal will be output to user 2 terminal.

Any idea how I could get script to automatically start recording each time you log in? Let's say I want to monitor what users are doing or have done when they log in to the server via ssh, is there a way I could get script to automatically start recording? Thanks.

Finally an enterprise scale Window Session recording solution is also available for microsoft windows OS. check ObserveIT at

Hi, this has been extremely helpful.

Thank you!


For the comments, instead of:

'echo "blah blah blah"'

You could just type:

'# blah blah blah'

The '#' will cause the shell to treat the line the same as commenting in a script file. That way you don't waste twice the space and time with an echo (and you can use the '!' and otherwise interpreted chars). Also, you can edit the file to add color to your comments. I found this REALLY useful, but had to download the file from as my distro didn't include a replay binary.

Hint: if your distro does color for the 'ls -l' command, look at the output for how to do color!