Suppose you are a go to person among your friends and family when it comes to Linux related questions. Someone asked you how to install and configure a tool, and you wanted to show the procedures. How would you do that if he or she is not in front of you? There could be various ways (e.g., by documenting and emailing the procedures, or explaining verbally over the phone, etc), but probably the most clearcut solution would be to demonstrate it yourself. If the demonstration only requires a terminal, then the best way would be use terminal screencast or terminal session recorder.
In this tutorial, I am going to demonstrate how to record and replay a terminal session on Linux.
There are several online services (e.g., showterm.io or asciinema.org) which allow you to record and share your terminal sessions on the web. However, if you want privacy, or want to archive the recordings locally, I would recommend TermRecord.
TermRecord is an open-source tool written in Python, which records a terminal session into a standalone HTML file. Since the HTML-formatted output file is self-contained, anyone can replay the captured terminal session using a web browser, which is cross-platform.
Install TermRecord on Linux
TermRecord is available as a Python package, so you can install the package with pip command.
First, install pip on your Linux system. Then, install TermRecord as follows.
Record a Terminal Session with TermRecord
Recording a terminal session with TermRecord is easy. Simply run the command below to start recording.
For example, to save the current terminal session in /tmp/session.html:
Then any subsequent commands that are typed from the terminal will be saved to the output HTML file. The output file will also store timing information, so that the whole terminal session can be replayed in the same speed as you are typing.
If you want to stop the recording, simply type "exit" and press ENTER.
If you open up the HTML output on a web browser, you can play, pause or restart the stored session. You can also adjust the replay speed, i.e., speed up or slow down the session replay as you like.
Here is a sample terminal screencast generated by TermRecord.
Subscribe to Xmodulo
Do you want to receive Linux FAQs, detailed tutorials and tips published at Xmodulo? Enter your email address below, and we will deliver our Linux posts straight to your email box, for free. Delivery powered by Google Feedburner.
Did you find this tutorial helpful? Then please be generous and support Xmodulo!
Latest posts by Dan Nanni (see all)
- How to install Suricata intrusion detection system on Linux - September 3, 2015
- How to switch from NetworkManager to systemd-networkd on Linux - August 31, 2015
- How to set up a system status page of your infrastructure - August 25, 2015