Record terminal session as gif


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.


  1. ttyrec
    $ sudo apt-get install ttyrec
  2. tty2gif
    Download the python script from the Bitbucket project or from here.
  3. python-opster (tty2gif dependency)
    $ sudo apt-get install python-opster
  4. convert utility
    $ sudo apt-get install imagemagick


  1. 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 command (in Step 3) isn’t added to your gif image. Continue doing your stuff …
    $ ttyrec
  2. Once done, press <Ctrl-d> to exit ttyrec recording session. You should have a ttyrecord file in the same location.
  3. Copy the script in the same directory. Convert the ttyrec session to a sequence of gif images:
    $ ./ typing ttyrecord
  4. Now generate the final gif image from the sequence:
    $ convert -delay 25 -loop 0 *.gif terminal.gif

2 thoughts on “Record terminal session as gif”

Leave a Reply

Your email address will not be published. Required fields are marked *