Introduction

I remember introducing a similar tool before, “VHS - A Tool for Generating CLI Animations”. This tool is very useful for recording videos or animations, but it doesn’t provide a vector-based method for playback. The final presentation to readers is either a video or an animation, which reduces the possibility of interaction between readers and the recorded content.

Overview

asciinema is a terminal recording tool developed in Rust. When recording terminal sessions, it generates .cast files, which are vector text files, meaning their size is only related to the content output in the terminal. It also provides an embedded web playback service, and of course, you can deploy your own service through self-hosting.

Installation

On macOS, you can install it using Homebrew. For other platforms, please refer to the official documentation.

brew install asciinema

Usage

Use the following command to start recording the command line, with the recording saved as demo.cast:

asciinema rec demo.cast

Here is the recording effect:

As you can see, the playback effect is similar to a video player, but the text in the playback can be selected and copied, which is different from recording videos. This method provides a better user interaction experience.

Conclusion

This tool is very suitable for IT teaching scenarios, but I’ve found some minor issues during use, such as the inability to directly browse through the history of terminal output, and some output content may exceed the window range of the playback.

I hope this is helpful, Happy hacking…