Tutorial

How To Record and Share Terminal Sessions Using Terminalizer on Ubuntu 18.04

Published on March 13, 2020
English
How To Record and Share Terminal Sessions Using Terminalizer on Ubuntu 18.04

The author selected the Electronic Frontier Foundation to receive a donation as part of the Write for DOnations program.

Introduction

Terminalizer is a terminal recorder application that allows you to record your terminal session in real-time, and then play it back at a later date. It works in the same way as a desktop screen recorder, but instead runs in your terminal.

Recording your terminal session is useful if you want to review a particular activity again, or to help debug a particularly tricky error. Recordings made with Terminalizer can also be exported as animated GIFs, which are great for sharing online or adding to marketing material for your software.

In this tutorial, you will install Terminalizer, use it to record and play back terminal sessions, customize your recordings, and then export them to share online.

Prerequisites

To complete this tutorial, you will need:

If you wish to share your recordings online, you’ll also need:

Once you have these ready, log in to your server as your non-root user to begin.

Step 1 — Installing Terminalizer

In this step, you will download and install Terminalizer on your system. Terminalizer is written using Node.js, and is available to install using the npm package manager.

To install Terminalizer globally on your system, run the following command:

  1. sudo npm install --global --allow-root --unsafe-perm=true terminalizer

Terminalizer uses the Electron application framework to export recorded terminal sessions into GIF format. The --unsafe-perms=true command argument is required in order to install Electron globally on your system.

Once Terminalizer has been installed, you’ll see similar output to the following:

Output
. . . /usr/local/lib └── terminalizer@0.7.1

Next, check your installation of Terminalizer by running:

  1. terminalizer --version

This will display something similar to the following:

Output
0.7.1

Finally, generate a default Terminalizer configuration file, which you can use for Terminalizer’s advanced customization (detailed further in Step 4):

  1. terminalizer init

This will produce output similar to the following:

Output
The global config directory is created at /home/user/.terminalizer

Now that you’ve installed Terminalizer, you can make your first terminal recording.

Step 2 — Recording and Playing Back a Terminal Session

In this step, you will record and playback a terminal session.

To begin, set up a new Terminalizer recording using a name of your choice:

  1. terminalizer record your-recording

This will output the following to indicate that the recording has started:

Output
The recording session has started Press Ctrl+D to exit and save the recording

You can now proceed to do anything that you want within your terminal. Each key press and command will be recorded in real-time by Terminalizer.

For example:

  1. pwd
  2. date
  3. whoami
  4. echo "Hello, world!"

When you’d like to stop the recording, press CTRL+D. Terminalizer will then save the recording to the specified file in YAML format, for example, your-recording.yml.

Output
Successfully Recorded The recording data is saved into the file: /home/user/your-recording.yml

You may be prompted by Terminalizer to share your recording online. Just press CTRL+C to cancel this for now, as you can playback the terminal recording locally first.

Next, play your recorded terminal session with the followng command:

  1. terminalizer play your-recording

This will replay the recorded session in real-time in your terminal:

Output
user@droplet:~$ pwd /home/user user@droplet:~$ date Sun Mar 8 14:55:36 UTC 2020 user@droplet:~$ whoami user user@droplet:~$ echo "Hello, world!" Hello, world! user@droplet:~$ logout

You can also adjust the playback speed of your recording using the --speed-factor option.

For example, the following will playback your recording twice as slowly (half speed):

  1. terminalizer play your-recording --speed-factor 2

Alternatively, you can play back your recording twice as fast (double speed):

  1. terminalizer play your-recording --speed-factor 0.5

You’ve recorded and played back a terminal session. Next, you can share a recorded terminal session online.

Step 3 — Sharing a Recorded Terminal Session

In this step, you’ll share your recorded terminal session online on the Terminalizer Explore page.

Begin by selecting a recorded session to share:

  1. terminalizer share your-recording

You will then be prompted to provide some basic metadata about your recording, such as the title and description:

Output
Please enter some details about your recording ? Title Title of Your Recording ? Description Description of Your Recording ? Tags such as git,bash,game Comma-separated Tags for Your Recording

Warning: Terminalizer recordings are shared publicly by default, so ensure that there are no personally identifiable or confidential details present in your terminal recording that you don’t want to share.

If this is the first time that you’ve shared a recorded session using Terminalizer, you’ll need to link your Terminalizer account. Terminalizer will display a verification link if this is required:

Output
Open the following link in your browser and login into your account https://terminalizer.com/token?token=your-token When you do it, press any key to continue

Warning: Ensure that you keep your Terminalizer token private, as it will allow anyone in possession of it to access your Terminalizer account.

Once you have visited the link in your web browser and signed in to your Terminalizer account, press any key to continue.

Terminalizer will now upload your recording and provide you the link to view it:

Output
Successfully Uploaded The recording is available on the link: https://terminalizer.com/view/your-recording-id

Visiting the link in a desktop web browser will allow you to view your shared recording:

A screenshot of the Terminalizer website, showing an example of a shared terminal recording

You’ve shared a recorded terminal session on the Terminalizer website and viewed it in your web browser.

Step 4 — Setting Advanced Terminalizer Configuration

Now that you’ve gained some familiarity with Terminalizer, you can begin to review some of the more advanced customization options, such as the ability to adjust the display colors and style.

Each recording inherits the default configuration from the global Terminalizer config file, which is located at ~/.terminalizer/config.yml. This means that you can edit the configuration for individual recordings directly by editing the recording file (e.g. your-recording.yml). Alternatively, you can edit the global configuration, which will have an impact on all new recordings.

In this example you’ll edit the global configuration file, but the same guidance applies to individual recording configuration files as well.

Begin by opening the global Terminalizer configuration file in your text editor, such as nano:

  1. nano ~/.terminalizer/config.yml

Each of the available configuration options within the file are commented in order to explain what they do.

There are several common configuration options that you may wish to adjust to your liking:

  • cols: Explicitly set the number of terminal columns used for your recording.
  • rows: Explicitly set the number of terminal rows used for your recording.
  • frameDelay: Override the delay between each keystroke during playback.
  • maxIdleTime: Specify a maximum time between keystrokes during playback.
  • cursorStyle: Specify the default terminal cursor style out of block, bar, and underline.
  • fontFamily: Specify a list of preferred playback fonts, in order of preference.
  • theme: Adjust the color scheme of the playback, for example to create a black-on-white terminal, etc.

As an example, you can achieve a white-on-black terminal display by configuring the following options:

config.yml
. . .
theme:
  background: "white"
  foreground: "black"
. . .

This will produce a result similar to the following:

A screenshot of the Terminalizer website, showing an example of a recording with a black-on-white theme

You could adjust the cursor style to make the recording easier to understand, for example by swapping the default block-style cursor with an underlined one:

config.yml
. . .
cursorStyle: underline
. . .

This produces a result similar to the following:

A screenshot of the Terminalizer website, showing an example of a recording with an underline-style cursor

Once you have made any desired changes, save the file and return to your terminal.

If you edited the global Terminalizer configuration, these settings will apply to all new recordings going forward. If you’re editing a specific recording configuration, Terminalizer will immediately apply the changes to that particular recording.

Note that custom playback styling only applies to shared recording sessions. Playing them back directly in your terminal will always use your default terminal styling and color scheme.

In this final step, you reviewed some of the advanced configuration options for Terminalizer.

Conclusion

In this article you used Terminalizer to record and share a terminal session. You now have the knowledge required to create recorded demos of your software for use in marketing material, or to share command-line tricks with friends.

If you wish to render and export Terminalizer recordings into GIF format, you can install Terminalizer on a machine with a graphical user interface/desktop and use the built-in rendering features:

You may also wish to browse the Terminalizer website to see recorded terminal sessions shared by other users:

Thanks for learning with the DigitalOcean Community. Check out our offerings for compute, storage, networking, and managed databases.

Learn more about our products

About the authors
Default avatar

Security Engineer

IT Security Engineer, technical writer and occasional blogger from the United Kingdom, with an interest in security defence and blue team activities.



Still looking for an answer?

Ask a questionSearch for more help

Was this helpful?
 
Leave a comment


This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Try DigitalOcean for free

Click below to sign up and get $200 of credit to try our products over 60 days!

Sign up

Join the Tech Talk
Success! Thank you! Please check your email for further details.

Please complete your information!

Become a contributor for community

Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.

DigitalOcean Documentation

Full documentation for every DigitalOcean product.

Resources for startups and SMBs

The Wave has everything you need to know about building a business, from raising funding to marketing your product.

Get our newsletter

Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.

New accounts only. By submitting your email you agree to our Privacy Policy

The developer cloud

Scale up as you grow — whether you're running one virtual machine or ten thousand.

Get started for free

Sign up and get $200 in credit for your first 60 days with DigitalOcean.*

*This promotional offer applies to new accounts only.