script: That terminal session recorder you always wanted

I wasn’t going to include script in these little adventures, but owe a day’s worth of programs after skipping a day yesterday, and script isn’t terribly difficult to cover.

It is difficult to show though, since you don’t really have any guarantee that what I’m doing is really working, if I can only show a static image. But script is part of util-linux, and it’s been around apparently since 3.0BSD, which translates to around 1979 and the same time the users command was added. So it’s probably available to you. 😯

Try this at home then, and see if you are as astounded as I was when I first saw it happen.

script -t 2> man.timing -a man.session

You should get an acknowledgement that says, “Script started, file is man.session”. Next,

man script

You can peruse that for a little bit. When you’re done, exit your man page reader and enter this:

exit

And the output is “Script done, file is man.session”.

So what good is that? Well, do this next:

scriptreplay man.timing man.session

And you get a perfectly timed session replayed as you like. And yes, it works with ncurses and fullscreen apps, and as far as I can tell, there doesn’t seem to be a limit on terminal dimensions (except perhaps on replay … I don’t expect it can cram a huge recording into a tiny window frame).

It’s funny, there are a baker’s dozen of console recording tools out there in the world, some working, some not — some even hotwired into cloud services and offering automatic uploads and infinite replays. 😐

I’m sure they all are fine and dandy. And yet, from the depths of util-linux comes a simple, straightforward terminal recorder that’s been around … well, since forever. :mrgreen:

One thought on “script: That terminal session recorder you always wanted

  1. Pingback: termrec, ttyrec, tty2gif and others: Pretty as a picture | Inconsolation

Comments are closed.