We mentioned ttyrec in one of our earlier articles. But wouldn’t it be cool if you could record a terminal session as a gif image and share with others? Here’s how to do it with simple cmdline tools.
$ sudo apt-get install ttyrec
Download the python script from the Bitbucket project or from here.
- python-opster (tty2gif dependency)
$ sudo apt-get install python-opster
- convert utility
$ sudo apt-get install imagemagick
- Run ttyrec. Start by typing
<Ctrl-l>to clear the screen so that the command is also cleared. This is needed to ensure that the tty2gif.py command (in Step 3) isn’t added to your gif image. Continue doing your stuff …
- Once done, press
<Ctrl-d>to exit ttyrec recording session. You should have a ttyrecord file in the same location.
- Copy the tty2gif.py script in the same directory. Convert the ttyrec session to a sequence of gif images:
$ ./tty2gif.py typing ttyrecord
- Now generate the final gif image from the sequence:
$ convert -delay 25 -loop 0 *.gif terminal.gif