Never Ending Security

It starts all here

How To Record Terminal Sessions on Linux

Record Terminal Session

There are several online services (e.g., or 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, we recommend you try 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.


TermRecord depends on three things currently:

  1. A version of the script command supporting recording of timing information into a file (the -toption on modern Linux distributions) or ttyrec
  2. term.js — minified (YUI), and embedded in the static template; MIT License
  3. Google Web Fonts (specifically Ubuntu Mono by default) — base64 encoded and embedded in the static template; Ubuntu Font License 1.0
  4. Jinja2 — Python templating engine; BSD License

Install TermRecord

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.

$ sudo pip install TermRecord


Just getting started? The defaults are probably fine for you, just specify an output HTML file and go:TermRecord -o mysession.html. For more complex operations checkout TermRecord --help.

There are three main modes of operation: (1) wrap the script program and dump JSON to stdout, (2) wrap the script program and dump HTML to stdout, (3) parse script log files with timing information saving output (JSON or HTML) to a file or dumping to stdout. The last mode is good for converting any old script sessions to HTML or JSON.

Recording a terminal session with TermRecord is easy. Simply run the command below to start recording.

$ TermRecord -o /path/to/output_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 selection of demos showing off the capabilities of TermRecord across a variety of shell sessions:

More information can be found at:

Leave a Reply

Please log in using one of these methods to post your comment: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s