Monday, 14 November 2016

Using TermRecord for recording terminal sessions

I recently used TermRecord & found it to be an awesome lightweight & fast tool for terminal recording.The installation was fairly simple. TermRecord is a program that wraps the script command. It automatically detects your terminal size, records your session, and stores the output as either JSON, embeddable JavaScript, or a static HTML file. The HTML is completely self-contained, embedding all necessary dependencies in one file and can be shipped to anyone that has a modern browser.
You can store these files as your own notes or use them as instructional examples, or whatever you want! 

I downloaded the source code from https://pypi.python.org/pypi/TermRecord.

I extracted the source code:

[root@cserver ~]# cd TermRecord-1.2.4/
[root@cserver TermRecord-1.2.4]# ls
bin  MANIFEST.in  PKG-INFO  setup.cfg  setup.py  termrecord  TermRecord.egg-info

Then I ran setup.py to install the package:

[root@cserver TermRecord-1.2.4]# python setup.py install
running install
running bdist_egg
running egg_info
writing requirements to TermRecord.egg-info/requires.txt
writing TermRecord.egg-info/PKG-INFO
writing top-level names to TermRecord.egg-info/top_level.txt
writing dependency_links to TermRecord.egg-info/dependency_links.txt
reading manifest file 'TermRecord.egg-info/SOURCES.txt'
reading manifest template 'MANIFEST.in'
writing manifest file 'TermRecord.egg-info/SOURCES.txt'
installing library code to build/bdist.linux-x86_64/egg
running install_lib
running build_py
creating build
creating build/lib
creating build/lib/termrecord
copying termrecord/__init__.py -> build/lib/termrecord
creating build/lib/termrecord/templates
copying termrecord/templates/dynamic.jinja2 -> build/lib/termrecord/templates
copying termrecord/templates/base.jinja2 -> build/lib/termrecord/templates
copying termrecord/templates/static.jinja2 -> build/lib/termrecord/templates
creating build/bdist.linux-x86_64
creating build/bdist.linux-x86_64/egg
creating build/bdist.linux-x86_64/egg/termrecord
copying build/lib/termrecord/__init__.py -> build/bdist.linux-x86_64/egg/termrecord
creating build/bdist.linux-x86_64/egg/termrecord/templates
copying build/lib/termrecord/templates/dynamic.jinja2 -> build/bdist.linux-x86_64/egg/termrecord/templates
copying build/lib/termrecord/templates/base.jinja2 -> build/bdist.linux-x86_64/egg/termrecord/templates
copying build/lib/termrecord/templates/static.jinja2 -> build/bdist.linux-x86_64/egg/termrecord/templates
byte-compiling build/bdist.linux-x86_64/egg/termrecord/__init__.py to __init__.pyc
creating build/bdist.linux-x86_64/egg/EGG-INFO
installing scripts to build/bdist.linux-x86_64/egg/EGG-INFO/scripts
running install_scripts
running build_scripts
creating build/scripts-2.7
copying and adjusting bin/TermRecord -> build/scripts-2.7
changing mode of build/scripts-2.7/TermRecord from 644 to 755
creating build/bdist.linux-x86_64/egg/EGG-INFO/scripts
copying build/scripts-2.7/TermRecord -> build/bdist.linux-x86_64/egg/EGG-INFO/scripts
changing mode of build/bdist.linux-x86_64/egg/EGG-INFO/scripts/TermRecord to 755
copying TermRecord.egg-info/PKG-INFO -> build/bdist.linux-x86_64/egg/EGG-INFO
copying TermRecord.egg-info/SOURCES.txt -> build/bdist.linux-x86_64/egg/EGG-INFO
copying TermRecord.egg-info/dependency_links.txt -> build/bdist.linux-x86_64/egg/EGG-INFO
copying TermRecord.egg-info/requires.txt -> build/bdist.linux-x86_64/egg/EGG-INFO
copying TermRecord.egg-info/top_level.txt -> build/bdist.linux-x86_64/egg/EGG-INFO
zip_safe flag not set; analyzing archive contents...
termrecord.__init__: module references __file__
creating dist
creating 'dist/TermRecord-1.2.4-py2.7.egg' and adding 'build/bdist.linux-x86_64/egg' to it
removing 'build/bdist.linux-x86_64/egg' (and everything under it)
Processing TermRecord-1.2.4-py2.7.egg
creating /usr/lib/python2.7/site-packages/TermRecord-1.2.4-py2.7.egg
Extracting TermRecord-1.2.4-py2.7.egg to /usr/lib/python2.7/site-packages
Adding TermRecord 1.2.4 to easy-install.pth file
Installing TermRecord script to /usr/bin

Installed /usr/lib/python2.7/site-packages/TermRecord-1.2.4-py2.7.egg
Processing dependencies for TermRecord==1.2.4
Searching for Jinja2==2.7.2
Best match: Jinja2 2.7.2
Adding Jinja2 2.7.2 to easy-install.pth file

Using /usr/lib/python2.7/site-packages
Searching for MarkupSafe==0.11
Best match: MarkupSafe 0.11
Adding MarkupSafe 0.11 to easy-install.pth file

Using /usr/lib64/python2.7/site-packages
Finished processing dependencies for TermRecord==1.2.4


The TermRecord binary was copied to /usr/bin.

Using TermRecord is fairly simple. Just specify the TermRecord command followed by -o & path to the output html file. Run the commands you'd like to record & type exit.

[root@cserver TermRecord-1.2.4]# TermRecord -o /tmp/test.html
Script started, file is /tmp/tmp4C9Aj3
[root@cserver TermRecord-1.2.4]# echo "This is strictly a test"
This is strictly a test
[root@cserver TermRecord-1.2.4]# echo "testing to see if TermRecord works!!"
echo "testing to see if TermRecord worksecho "This is strictly a test""
testing to see if TermRecord worksecho This is strictly a test
[root@cserver TermRecord-1.2.4]# exit
exit
Script done, file is /tmp/tmp4C9Aj3

No comments:

Post a Comment

Using capture groups in grep in Linux

Introduction Let me start by saying that this article isn't about capture groups in grep per se. What we are going to do here with gr...