I am (or rather, was) a very heavy script(1) user. I like to use a program to (among other things) automatically log the content of all my ssh sessions, so if I need to look back at something, I always can. Disk is cheap these days, so why not keep logs with which to answer "what happened when" questions?

However, I also like to use a huge pager in fvwm2, and just leave terminals open a long time. This means I don't have to log in and out again and again throughout a workday; instead I can just leave terminals open on the common hosts, and reuse those. This usually makes a day a little more productive.

The combination wasn't ideal - using script(1) and not logging out much - because although I was dating my script(1) logs, they were dated solely by the start date. Yes, I modified my PS1 (shell) prompts to give a timestamp, but that's not quite as useful when you have thousands of (potentially compressed) tty log files you want to look through quickly.

So I wrote pypty, which is a reimplementation of script(1) with a little more functionality thrown in. It should be a drop in replacement for traditional use (right down to interoperating with scriptreplay(1)), and being only slightly slower if you use pypy.

The main benefit at this time is that it has a -d option implementing a "dated files" mode. In this mode:

Future enhancements:

The usage message looks like:

Example usage looks like:

Then there's script-replay, which is also part of the pypty distribution.

It just lets you walk through a file, forward and back, a character, line or page at a time. It doesn't require a special timing file - script(1) timing files often being rather large compared to the tty logs themselves.

It's a little primitive, but I've found it functional.

It should work fine with both script(1) typescript's and pypty typescript's.

It has a curses interface as well as a gi.repository.Gtk interface; it works with CPython 2.x or 3.x.


Back to Dan's tech tidbits

You can e-mail the author with questions or comments: