terminal ascii art

Command-Line Recording With Asciinema

9801 VIEWS

·

Have you ever wanted to record and share your terminal sessions with someone else? The usual way of going about this is recording your terminal sessions with a screen recorder like CamStudio, recordMyDesktop, ScreenFlow, or Screencast-O-Matic. These apps are great for most tasks but are not always suitable for recording terminal sessions, and the resulting videos from some of these tools are quite big. Asciinema (pronounced as-kee-nuh-muh) is a tool designed to make recording terminal sessions extremely easy.

Asciinema videos are text-based, and only what gets printed is captured; hence, they are far smaller than those generated by most screen recorders. Asciinema is available on Linux, Mac OS X, and BSD; it is not available on the Windows platform because of the lack of a pseudo terminal. However, the program is hosted on GitHub, and with some workarounds, can run on Windows.

Installation
There are several ways to install the software for the various platforms.

#  Debian
$  sudo apt-get install asciinema

#  Arch
$  pacman -S asciinema

#  Mac
$  brew install asciinema

A full list of other installation procedures including Snap, Docker, and pip can be found on this page. Without installing the app, you can still run the app directly from the source.

Now that you have asciinema installed, you can go ahead and run the app from the terminal to begin recording your terminal session. Once invoked, there is no need to adjust anything, as every command typed is recorded by asciinema in the background. A point worth noting is that without specifying a local file, asciinema recordings are automatically uploaded to asciinema.org. (There’s a fix for this that allows you to delete automatically uploaded recordings.) To exit terminal recording, press Ctrl + D or enter “exit.” The local file can be replayed or uploaded to asciinema.org, after which a URL to the uploaded file will be generated.

#  Record and store locally
$  asciinema rec recording.json
 
#  End recording with Ctrl + D or exit

# Upload Recording 
$  asciinema upload recording.json
https://asciinema.org/a/LInRw32pmoOKUayzgUdh5blE3

To manage recordings uploaded from your computer to asciinema.org, enter asciinema auth. Then, follow the URL given to associate the recordings with your profile. This lets you edit the title, terminal theme, description, and thumbnail frames of your recordings. The privacy level (public or private) can also be changed from here.
The URL link to any asciinema recording can be shared with others for access, even if the privacy of the recording is set to private. Since asciinema supports oEmbed, Open Graph, and Twitter Card APIs, beautiful thumbnails are generated when shared on many social media networks.
Embedding a recording is also possible. The video player can be embedded in your website. Customizing the attributes of the embedded recording is also an option, including theme, font, timing, speed, etc. And not only can you embed a video, but also a screenshot that links to the video. From your videos on asciinema.org, you can click on a video’s share link to get the embedding codes for your recording.

# Embedded image link

# Embedded video player link


# Markdown
[![asciicast](https://asciinema.org/a/LInRw32pmoOKUayzgUdh5blE3.png)](https://asciinema.org/a/LInRw32pmoOKUayzgUdh5blE3)

Final Thoughts

You will find this tool really handy should you want to quickly share a terminal tutorial with someone. Recordings can be embedded in documentation pages, blog posts, and in slides for conferences. The small size of the recordings makes for easy transmission. In short, recording a terminal session is best done with a terminal recorder like asciinema.


Bruno is a junior at Ashesi University College studying Computer Science. He is interested in leveraging the power of technology to increase productivity. As a big fan of open source technology, he is currently exploring the possibility of using the Bitcoin Blockchain to fight corruption in government. Bruno is a regular contributor at Fixate IO.


Discussion

Click on a tab to select how you'd like to leave your comment

Leave a Comment

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

Menu
Skip to toolbar