reference: https://github.com/icholy/ttygif
1 Method
1.1 Steps
$ sudo apt-get install imagemagick ttyrec gcc x11-apps make git
$ git clone https://github.com/icholy/ttygif.git
$ cd ttygif
$ make
$ sudo make install
$ sudo apt-get install ttyrec
$ sudo apt-get install imagemagick
$ sudo apt-get install python-opster
$ sudo apt-get install xdotool
If you're getting Error: WINDOWID environment variable was empty., then you need to manually set WINDOWID.
export WINDOWID=23068679
If you're on Ubuntu, you can use xdotool to find the WINDOWID
$ export WINDOWID=$(xdotool getwindowfocus)
2 Usage
export WINDOWID=$(xdotool getwindowfocus)
2.1 Create ttyrec recording
$ ttyrec myrecording
Hit CTRL-D or type exit when done recording.
2.2 Convert to gif
$ ttygif myrecording