How to Record Terminal Sessions on Linux Using asciinema

Konstantin Dokuchaev
Konstantin Dokuchaev
How to Record Terminal Sessions on Linux Using asciinema

asciinema is a tool for recording terminal sessions into .cast files, which can be replayed and shared without the need for screencasts.

To be honest, I’m not sure why you would want to record your terminal sessions using anything other than a screencast application. However, if you’re curious about how to do it with asciinema, I’ll explain it here.

asciinema is a command-line utility that allows you to record terminal activity without using any special applications. The recordings are saved in a format that can be replayed using the same tool.

To install asciinema, you’ll first need to install pipx using the command sudo apt install pipx, and then you can install asciinema itself with pipx install asciinema.

There are alternative installation options as well, which you can explore on this page.

To start recording a terminal session, use the command:

asciinema rec test.cast

Here, .cast is the name of your future recording file.

Now, you can perform any necessary actions in the terminal, and they will be recorded automatically. To stop the recording, press Ctrl+D or type exit.

The completed recordings will appear in the user’s home directory as .cast files.

To play back a recorded file, use the command:

asciinema play test.cast

You can share these recordings with the world on asciinema’s official website using the command:

asciinema upload demo.cast

Below you can see an example of such a recording:



Great! Next, complete checkout for full access to All-in-One Person
Welcome back! You've successfully signed in
You've successfully subscribed to All-in-One Person
Success! Your account is fully activated, you now have access to all content
Success! Your billing info has been updated
Your billing was not updated