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?

AttachmentSize
acct-scriptreplay.tgz2 KB

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

For the comments, instead

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 scriptreplay.pl from http://www.koders.com/perl/fidABF0B418C7D5C0DE115305818FE5A6AB2C6AA73F.aspx 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!

bash recording

Hi, this has been extremely helpful.

Thank you!

R.

Window Session Replay

Finally an enterprise scale Window Session recording solution is also available for microsoft windows OS. check ObserveIT at www.observeit-sys.com

You can even "share" your

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 to...

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.

Great tips

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

That happened for me also.

That happened for me also. this was really helpful.

Yeah, my sentiments exactly.

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. :)