Science and technology

Record your terminal session with Asciinema

Support calls are necessary and infrequently satisfying ultimately, however the act of clear communication could be arduous for everybody concerned. If you’ve got ever been on a assist name, you’ve got most likely spent a number of minutes spelling out even the shortest instructions and explaining intimately the place the areas and returns fall. While it is typically simpler to only seize management of a person’s laptop, that is not likely the easiest way to coach. What you may attempt as an alternative is sending a person a display screen recording, however one which they will copy instructions from and paste into their very own terminal.

Asciinema is an open supply terminal session recorder. Similar to the script and scriptreplay instructions, Asciinema information precisely what your terminal shows. It saves your “movie” recording to a textual content file after which replays it on demand. You can add your film to Asciinema.org and share them simply as you’d another video on the web, and you’ll even embed your film right into a webpage.

Install Asciinema

On Linux, you possibly can set up Asciinema utilizing your bundle supervisor.

On Fedora, CentOS, Mageia, or related:

$ sudo dnf set up asciinema

On Debian, Linux Mint, or related:

$ sudo apt set up asciinema

On macOS, you possibly can set up utilizing Homebrew:

$ sudo brew set up asciinema

On BSD and another platform utilizing Pkgsrc:

$ cd /usr/pkgsrc/misc/py-asciinema

$ sudo bmake set up clear

Making films out of textual content

To begin recording with Asciinema, you employ the rec subcommand:

$ asciinema rec mymovie.forged

asciinema: recording asciicast to mymovie.forged

asciinema: press <ctrl-d> or sort "exit" once you're accomplished

Some pleasant output alerts you that you simply’re recording, and it tells you tips on how to cease: Press Ctrl+D or simply sort exit.

Everything you do in your terminal whereas Asciinema is lively will get recorded. This consists of enter, output, errors, awkward pauses, errors, or successes. If you see it in your terminal throughout recording, it makes the reduce.

When you are completed demonstrating how the terminal works, press Ctrl+D or sort exit to cease the recording.

In this instance, the ensuing file, mymovie.forged is a group of timestamps and actions that function a script (within the sense of a film script) for the playback mechanism.

{"version": 2, "width": 139, "height": 36, "timestamp": 1641457358, "env": {"SHELL": "/bin/bash", "TERM": "xterm-256color"}}

[0.05351, "o", "u001b]0;seth:~u0007"]

[0.05393, "o", "u001b[1;31m$ u001b[00m"]

[1.380059, "o", "e"]

[1.443823, "o", "c"]

[1.514674, "o", "h"]

[1.595238, "o", "o"]

[1.789562, "o", " "]

[2.09658, "o", """]

[2.19683, "o", "h"]

[2.403994, "o", "e"]

[2.466784, "o", "l"]

[2.711183, "o", "lo"]

[3.120852, "o", """]

[3.427886, "o", "rnhellorn"]

[...]

If you’ve got made a mistake, you possibly can reduce the error by eradicating the strains recreating the error. Should you end up making a lot of edits or belaboring lengthy pauses throughout the recording, you possibly can set up and use the asciinema-edit utility, which might trim out blocks of “footage” by timestamps of your definition, or by eliminating idle time.

Playing an Asciinema film

You can playback your Asciinema utilizing the play subcommand:

$ asciinema play mymovie.forged

This takes over your terminal session and makes it into the closest equal of the Silver Screen because it’s possible ever to be (other than that point you watched Star Wars in ASCII over telnet). Your text-based film performs—demonstrating on your customers precisely how a posh activity will get accomplished. Of course, the precise instructions getting performed do not truly execute. This is not a shell script in motion, so though you could have created a file hi there.txt in your film, there will not be a brand new hi there.txt after playback. This is only for present.

And but it is greater than only a present. You can pause Asciinema films, choose the textual content you see on the display screen and paste it into an lively terminal to run the command. Asciinema is beneficial documentation. It exhibits customers tips on how to do a activity, and it permits them to repeat and paste to make sure accuracy.

Upload your Asciinema film 

No Asciinema film has but reached a blockbuster standing, however you possibly can add yours to Asciinema.org and share it with the world however.

$ asciinema add mymovie.forged

If you are used to YouTube add instances, you will be pleasantly shocked by how rapidly Asciinema films switch. A .forged file is often only some kilobytes, or on the most a number of megabytes, so the add is sort of instantaneous. You do not want an account to share your film, however all unclaimed films get deleted after seven days. To protect your masterpiece, you possibly can open an account on Asciinema after which sit again and await the Academy to name.

Asciinema as documentation

Asciinema is an effective way to display even probably the most primary of ideas. Because it retains the power to repeat and paste code from the recording, gives the power to pause and play on-demand, and is totally correct in what it portrays, it is not simply nearly as good as a display screen recording. It’s a lot, significantly better. Whether you employ it to point out off your terminal abilities to your pals or whether or not you employ it to coach colleagues and college students, Asciinema is a useful, social, and accessible software.

Most Popular

To Top