Record and Share your Terminal


Obvioulsy, one way to do that is use a screen-recorder software that records and exports it as a video which you can share it with others. But consider the quality and file size.

This is where tools like asciinema comes in. Couple of years back, I started using asciinema to record my terminal and I called them Terminal casts. Terminal casts are not videos. They are plain text files that can be replayed in any environments.

But how do they do it? In fact, we don’t even need to install and use asciinema, because under the hood, it makes use of two programs called script to record and scriptreplay to playback. These two programs are installed by default as a part of many GNU/Linux distribution.

We can invoke script like this

script --timing=time.txt terminal_record.txt

The above will start recording all our commands in a file called terminal_record.log, the --timing will take care of recording the time that we take to type so that, it can be used to replay with the same time delay as ours. Type exit to stop recording.

To playback,

scriptreplay --timing=time.txt terminal_record.txt

Cool isn’t it? Next time, if someone says you something doesn’t work on their terminal, ask them to share their timing and recorded text files, so that you can see what they did. You can also send them what you created!

Discourse (this platform) doesn’t allow me to upload txt files, else, I would share my terminal recordings now :smile: