Skip to main content

Posts

Showing posts from March, 2016

Recording terminal sessions

All coders have some use for screen casting a terminal session, usually to demo a command line tool. The old way I did this (when I migrated to a Mac) was to use Quicktime's screen recording feature, which really is superb. Then I learned of asciinema. Asciinema was very novel for me because it looked like a movie, when played through the slick player they have, but you can just go an select the text that is 'playing' and copy paste it into a terminal. Amazing!

Reading a little deeper into asciinema's docs we find that Linux actually has built in infrastructure for recording terminal sessions - with timestamps! - and also for then playing those sessions back. You use script to record the keystrokes and responses and scriptreplay to play them back! Magic!

But there is more. There is a Python package called TermRecord that packages these utilities and then dumps the output to a standalone html file! This is most convenient for sharing demos etc because everyone has acce…