Termtosvg – Record your terminal sessions as SVG animations in Linux

History command is one of our favorite to review/recall the previously entered commands in terminal.But unfortunately, that shows only the commands that we ran and doesn’t shows the commands output which was performed previously.

There are many utilities available in Linux to record the terminal session activity.

Termtosvg tool will help us to record the users terminal activity, also will help us to identify other useful information from the output.

Also, we had written about few utilities in the past and today we are going to discuss about the similar topic.

If you would like to check other utilities to record your Linux terminal session activity then you can give a try to

But if you are looking for GIF Recorder then try

Script is one of the best utility to record your terminal session on headless server.It is a Unix command line utility that records a terminal session (in other terms, It records everything displayed on your terminal).

It stores the output in the current directory as a text file and the default file name is typescript.

What is Termtosvg

Termtosvg is a Unix terminal recorder written in Python that renders your command line sessions as standalone SVG animations.

Termtosvg Features

  • Produce lightweight and clean looking animations embedded on a project page.
  • Custom color themes, terminal UI and animation controls via SVG templates.
  • Compatible with asciinema recording format.
  • It requires Python version  >= 3.5

How to install Termtosvg in Linux

It is written in Python and pip installation is a recommended method to install Termtosvg on Linux.

Make sure you should have installed python-pip package on your system. If not, use the following command to install it.

For Debian/Ubuntu users, use Apt Command or Apt-Get Command to install pip package.

$ sudo apt install python-pip

For Archlinux users, use Pacman Command to install pip package.

$ sudo pacman -S python-pip

For Fedora users, use DNF Command to install pip package.

$ sudo dnf install python-pip

For CentOS/RHEL users, use YUM Command to install pip package.

$ sudo yum install python-pip

For openSUSE users, use Zypper Command to install pip package.

$ sudo zypper install python-pip

Finally run the following pip command to install Termtosvg tool in Linux.

$ sudo pip3 install termtosvg pyte python-xlib svgwrite

How to Record your terminal session using Termtosvg

Once you successfully installed Termtosvg. Just run the following command to start the recording.

$ termtosvg
Recording started, enter "exit" command or Control-D to end

For testing purpose run few commands and see whether it’s working fine or not.

$ uname -a
Linux daygeek-Y700 4.19.8-2-MANJARO #1 SMP PREEMPT Sat Dec 8 14:45:36 UTC 2018 x86_64 GNU/Linux
$ hostname
daygeek-Y700
$ cat /etc/*-release
Manjaro Linux
DISTRIB_ID=ManjaroLinux
DISTRIB_RELEASE=18.0
DISTRIB_CODENAME=Illyria
DISTRIB_DESCRIPTION="Manjaro Linux"
Manjaro Linux
NAME="Manjaro Linux"
ID=manjaro
ID_LIKE=arch
PRETTY_NAME="Manjaro Linux"
ANSI_COLOR="1;32"
HOME_URL="https://www.manjaro.org/"
SUPPORT_URL="https://www.manjaro.org/"
BUG_REPORT_URL="https://bugs.manjaro.org/"
$ free -g
free: Multiple unit options doesn't make sense.
$ free -m
free: Multiple unit options doesn't make sense.
$ pip3 --version
pip 18.1 from /usr/lib/python3.7/site-packages/pip (python 3.7)

Once you have done, simply press CTRL+D or type exit to stop the recording. The result will be saved in /tmp folder with a unique name.

$ exit
exit
Recording ended, SVG animation is /tmp/termtosvg_5waorper.svg

We can open the SVG file output with help of any web browser.

$ firefox /tmp/termtosvg_5waorper.svg

About Magesh Maruthamuthu

Love to play with all Linux distribution

View all posts by Magesh Maruthamuthu

Leave a Reply

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