Install asciinema using apt :
apt install asciinema
Install svg-term using npm :
sudo npm install -g svg-term-cli
Record the terminal :
asciinema rec record.cast
Use ctrl + d to stop recording.
Then to generate a dynamic svg file :
cat record.cast | svg-term --out generated.svg --window