Skip to content

The Deska blog

Recording Terminal Demos With asciinema

Learn the best practices for recording terminal demos with asciinema, including installation, recording tips, and integrating it with Deska workspaces.

10 min read

Recording terminal demos with asciinema has become the standard for developers who want to share command line interactions without the overhead of heavy video files. Unlike traditional screen recording, this tool captures the actual text output and timing of your terminal session. This allows viewers to copy and paste text directly from the player, making it an ideal choice for documentation, bug reports, and educational content.

Understanding the asciinema Format

At its core, asciinema does not record pixels. It records the data stream of the terminal session and saves it in a JSON based format called an asciicast. This approach offers several technical advantages over GIF or MP4 files.

  1. Portability: The resulting files are extremely small, often just a few kilobytes for several minutes of recording.
  2. Accessibility: Since the output is text, screen readers can interpret the content much better than they can a video.
  3. Quality: The playback is always crisp because it renders using the viewer terminal fonts rather than compressed video frames.

When you record a session, the tool captures the timing of each character appearing on the screen. This means that pauses, deletions, and rapid typing are all preserved exactly as they happened.

Getting Started With Installation

The tool is written in Python and is available on most package managers. For macOS users, Homebrew is the most common path. Linux users can typically find it in their native repositories like apt or pacman.

Once installed, you can verify the version to ensure everything is set up correctly. The CLI is lightweight and does not require a background daemon to run. It functions by spawning a new shell and capturing the standard output of that shell while it is active.

Recording Your First Session

To start recording terminal demos with asciinema, you simply run the rec command. You can provide a filename to save the recording locally, which is recommended for privacy and editing purposes.

While recording, it is important to remember that everything you type is captured. This includes typos and backspaces. While this adds to the authenticity of a demo, you may want to practice a script beforehand to ensure the flow is logical for the viewer.

To finish a recording, you use the exit command or press Ctrl-D. The tool will then ask if you want to upload the recording to their hosting service or keep it locally. Keeping it local allows you to inspect the file and even perform manual edits on the timing or text if necessary.

Integrating asciinema with Deska

For developers using Deska, recording terminal demos becomes even more structured. Since Deska provides a terminal experience within an infinite canvas, you can record specific workflows while having other context visible.

Deska allows you to arrange multiple panels side by side. You might have one terminal running asciinema to record a CLI tool, while a neighboring panel displays the source code in the Monaco editor. This setup is particularly useful for creating comprehensive documentation where the code and the terminal output are both relevant.

The canvas environment in Deska is local-first, meaning your files and terminal sessions stay on your machine. This aligns well with the local recording capabilities of asciinema. If you are using coding agents like Claude Code or OpenCode in a panel, you can record how these agents interact with your CLI tools to demonstrate automated workflows.

Comparison of Recording Methods

There are several ways to share terminal activity. Choosing the right one depends on your specific needs for the demo.

FeatureasciinemaTraditional VideoAnimated GIF
File SizeExtremely SmallLargeMedium to Large
Text SelectionSupportedNot SupportedNot Supported
Visual FidelityHigh (Text)High (Pixels)Low (Limited Colors)
HostingSelf or asciinema.orgYouTube/VimeoAny Image Host

Asciinema differs in approach from tools like OBS or Screenflow because it focuses exclusively on the character stream. While you lose the ability to show mouse movements or GUI elements, you gain the ability to search and copy the content.

Advanced Recording Tips

To make your recordings professional, consider these technical adjustments:

  • Idle Time Limit: Use the -i flag to cap long pauses. If you are waiting for a package to install, you can set a maximum idle time of 2 seconds so the viewer does not get bored.
  • Terminal Size: Consistency is key. Try to record at a standard size, such as 80x24 or 120x30, to ensure the playback fits well on most screens.
  • Environment Cleaning: Before you begin, clear your prompt of sensitive information. You can use a temporary shell profile to simplify your PS1 prompt for a cleaner look.

If you are using the mobile app to monitor your work, remember that you can check on long running processes or recordings through the secure relay. This allows you to step away from your desk while a long demo or build process finishes its recording cycle.

Managing Your Recordings

Once you have a collection of recordings, you need a way to organize them. Because asciicast files are just text, you can version control them using Git. This is a significant advantage over binary video files which bloat repository sizes.

In a local-first workflow, keeping your demos alongside your documentation ensures that they are always up to date with the latest code changes. You can use the Deska notes panel to keep track of the commands you intend to record, creating a live script that you can follow while the recording is active.

FAQ

how to edit asciinema recordings

Since the output is a JSON file, you can open it in any text editor. Each line represents an event with a timestamp and the data sent to the terminal. You can manually adjust the timestamps to speed up or slow down specific sections, or delete lines to remove mistakes.

how to embed asciinema in website

The easiest way is to use the official JavaScript player. You include the script on your page and point it to the URL of your .cast file. This renders a high quality terminal interface that supports playback, seeking, and text selection directly in the browser.

asciinema vs screen recording for devs

Asciinema is generally preferred for pure command line tutorials because of the small file size and copy-paste support. However, if your demo requires showing a web browser or a specific IDE feature outside of the terminal, a standard screen recording tool might be more appropriate.

Take Control of Your Terminal Demos

Recording terminal demos with asciinema provides a level of clarity and utility that video cannot match. By focusing on the raw text and timing, you create a resource that is as functional as it is informative.

If you are looking for a workspace that brings your terminals, code, and AI agents together in one place, you can download Deska for free. It provides the ideal environment to build, test, and document your projects using the tools you already love.