How to embed recorded terminal sessions (Asciicasts) in your posts

How to complement your Medium posts with recorded terminal sessions

Medium is a single platform hosting blogs of different genres, with about 60 million readers per month. Publishing there brings many advantages – access to a broad engaged audience, excellent SEO capabilities, and simplicity of use. Presence on Medium can bring you many benefits, mostly if you write about business, startups, technology, life learning, entrepreneurship, politics, or culture.

If you run a Tech Blog on Medium like us, you probably wonder how to diversify the content of your articles. In our case, recorded terminal sessions are a great solution. But how do I put the recording on a platform that doesn’t support Asciicats?

Read our tutorial to learn in three easy steps to complement your Medium posts with recorded terminal sessions to create better explainers and demonstrators.

Asciicasts — what’s under the hood

An Asciicast is the output file of a terminal recorder (e.g., Asciinema) stored as a text document. Asciicasts are a way to share a *NIX terminal screen with your audience. Instead of embedding dozens of images, you can create a movie-like experience to depict better what was going on in your command line.


Converting an Asciicast into a GIF.

You can embed Asciicats on a regular web page, but Medium does not support it yet, so here’s a simple guide on overcoming the issue.

Step 1: Recording a terminal session
To record a session, you should have the asciicast binary installed on your system.

Step 2: Cleanup sensitive information
When you’re recording a terminal, private or sensitive information could also be captured, so it’s always a good practice to double-check and cleanse your Asciicast file. You can also adjust the configuration of the recording (for example, the height or width of the terminal).

Step 3: Creating a GIF animation
We can convert the recorded cast into an animated GIF image using the asciicast2gif tool in the final step.

The process takes no more than a few seconds, and the created GIF file can be embedded in your Medium posts.

Read more on Medium