How to record terminal on Linux

Endrit Qerreti

Endrit Qerreti

Have you ever wanted to record only your terminal and not the whole desktop? Asciinema is a tool that allows you to record your terminal without hassle.

Asciinema records only the terminal, which means anything outside of the terminal won't be recorded. This tool is useful when you are working on a task on your terminal, and you want it to share it with your friends.

It's worth mentioning that, asciinema apart from recording, it also allows you to upload your recording on their site, so you can easily share your recordings via a dedicated url.

Once recording is completed, you can choose whether you want to save your recording on your machine or upload it on asciinema's website.

In this tutorial, you will learn how to record your terminal on Linux. In this tutorial, we are using Ubuntu 22.04.

Step 1 - Add asciinema Repository

To be able to install asciinema on your system, you must add its repository on your system first. To do this, simply run the command below

sudo apt-add-repository ppa:zanchey/asciinema

Next, authenticate and press enter

Once you have authenticated, you can now press enter to add asciinema repository on your system

Step 2 - Update your system

Once you have added asciinema repository on your system, now you need to update your system so that asciinema repository can be used to download asciinema.

sudo apt update

You should see asciinema repository showing on the output, meaning asciinema repository is now active and you can proceed to install asciinema.

Step 3 - Install asciinema

Now that asciinema repository is active on your system, install asciinema by running the command below

sudo apt install asciinema

How to record your terminal

To record your terminal with asciinema, is easy.

Launch the terminal that you want to record, and run the asciinema rec command to start recording

asciinema rec

Once you run the command above, your terminal session will be recorded

To save your recording, you can simply exit from your shell session or press CTRL + D

How to Play your recording

When you exit the shell session that was being recorded, asciinema will automatically save the recording file, and it will show the path where the recording was saved

Asciinema saves the recording files in a .cast format, so to play this file you can use the play command

For example, our recording file was saved on the temporary directory

asciinema play /tmp/file.cast

And the recorded session will play on your terminal

How to upload your recording to

Each time you record your terminal, you will be asked whether you want to save your recording locally or upload it to However, you can upload your recording directly using the commands below.

To upload a recorded session you can use the upload command

asciinema upload file.cast

You can also use the -t option to give your recording a custom title

asciinema rec -t "This is my title" 

Note: You must have an account on in order to upload your videos on your account, so they don't get deleted. Simply create an account on, and then connect your machine with asciinema auth

This is how a recorded terminal looks like

Hello World

For more commands about asciinema, simply run the help command

asciinema help


In this tutorial, we showed you how to record your terminal on Ubuntu 22.04, with asciinema.