How To Record and Share Linux Terminal Activity using Asciinema

Writing is a one method to save our knowledge. Using this method, we can produce - let say - books. Along with advances in technology, we can convert paper into file. Since the speed of Internet is becoming faster, video is more preferable. For some cases, I prefer to watch video than reading. Then, now video recording is one the method to save and share our knowledge's to others.

If you are using Linux, there is a video recording tool to help you. The tool is named Asciinema.

What is Asciinema

Here is the quote from it's website about what is Asciinema :

asciinema [as-kee-nuh-muh] is a free and open source solution for recording terminal sessions and sharing them on the web.

Asciinema also a light-weight and purely text-based terminal recording tool. It support most Linux distribution and *BSD
A video which is created using Asciinema software is called Asciicast.

Installing Asciinema

While Asciinema support most of Linux distribution, this article shows you how to install Asciinema using Ubuntu Linux 16.04 edition.

First, we need to add asciinema repository to our PPA using this command :

sudo apt-add-repository ppa:zanchey/asciinema

Add Asciinema PPA

Second, we need to update our Ubuntu repository :

sudo apt-get update

Last, we can proceed to install Asciinema :

sudo apt-get install asciinema

Install Asciinema

Start recording using Asciinema

Using Asciinema is very easy. Once Asciinema installed, you can start recording by typing this command on your terminal.

asciinema rec

Start recording

Once you run the command, you can immediately start recording. Any typing activity on your terminal will be recorded. When you are done, just press Ctrl-D to stop recording.

To save it to your local disk use this command :

asciinema rec /path/to/yourfilename.json

It will save your recording file into /home/user/ directory with yourfilename.json file.

How about the size of the recording file? A recorded file with 53 seconds length is about 17Kb.

Video Size

So let say if 60 seconds / 1 minute file will occupied 20Kb, then 60 minute / 1 hours file length will occupied 60 x 20Kb = 1200Kb only! (around 1,2 Mb)

How to Play it?

After we successfully create an asciicast file, the next thing we want to do is to play it. There are some methods how to play it.

First using from your teminal just type :

asciinema play /path/to/yourfilename.json

Play Asciinema video

The video will play immediately.

Second, if you upload the video to website, then you can use this format to play it :

asciinema play https://yourwebsite/path/to/your/video.json

Third, you can play it remotely.

ssh pungki@10.0.2.15 cat using_asciinema.json | asciinema play -

Play Remotely

Play Remotely

Upload the video file

When you create a video recording file, normally you will create it on your local file. Then after you are sure about the content and quality, you may want to upload it to asciinema.org website.

Uploading it is very easy. Just use upload parameter to upload it into asciinema.org

asciinema upload using_asciinema.json

Wait until a link to play it appear.

Link to Play

Link to Play

Then copy-paste the link into your browser to play it.

Play from Web

Play from Web

Manage what you have uploaded

If you want to manage what you have upload to asciinema.org website, then you need to use auth parameter.

asciinema auth

Auth Link

Auth Link

But first, you need to login to asciinema.org.

Once you logged in, you will see how many video you have uploaded.

  • Pick one
  • Scroll down until you see a gear icon on the bottom left
  • Click it, then click Edit
Edit video parameter

Edit video parameter

Now you will see parameters to edit. Don't forget to Save it :-)

Auth Fields

Auth Fields

Conclusion

For those who like or want to documenting your console activity, for any reasons, asciinema offers us a great and easy tool. A lightweight application, easy to use, using an open-standard format file, and easy to share.

About Pungki Arianto

Pungki , currently working as a Linux / Unix administrator for a banking company. He love to work in Linux / Unix since it's fun for him. He is also interested in information technology, information security and writing.

Author Archive Page

Have anything to say?

Your email address will not be published. Required fields are marked *

All comments are subject to moderation.