When you want to geek out with others, but it can look nice as well. 🤓

All of this is done on my Linux desktop (Arch Linux) but should work on other distros / OSes like OS X / *BSD with little to none work.

If you have any problems getting this to work, feel free to contact me and I’ll do my best to help you getting things up and running.

Why?

So why would you record your terminal? Well there are many reasons for recording your terminal anything from sharing a command with a friend, writing pretty articles for the web, having animations in documentation or even to make pretty slideshows!

What options are there?

There are a lots of options when you want to record a terminal / monitor.
This is just a small list of some of the options ive tried.

  • Simple screenshot
  • Record video
  • asciinema
    • uploaded to cloud
    • asciinema-player (JS include for websites)
    • asciicast2gif (Only V1 asciinema recordings og gifs. Not SVGs)
    • asciicast-to-svg (Only V1 asciinema recordings)
  • termtosvg <- My winner! ⭐
    • demo-magic.sh

Why my choice was termtosvg.

Why I returned to termsvg. (Spoiler: The other projects are dead).

termtosvg-01

Simple Copy / Paste recorded via termtosvg. Not very impressive…

So what now?

What else can we do to make it even better.

Simulate keyboard input

To simulate keyboard input in the terminal? Yes please.

xclip / xdotool

Step one in the hunt, xclip and xdotool.

termtosvg-02

termtosvg test with xclip / xdotool.

Better than just a Copy / Paste - But we can do even better!

Click for more info on this method.

pv

Moving on to pv…

pv is a tool that you pipe text to and it outputs it in a simulated typing effect way (?!).

You can also make short script files to have it “scripted” as a single command.

echo "Hello, World!" | pv -qL 4

I found this from this YouTube video:

Never got this to work well enough to even make a recording of it. But that totally could be me not knowing what Im doing. 🤦🏻‍♂️

It was like it was running in the “background” and the just pasted it all at once.

So on to the next one!

demo-magic

$ ./my-demo.sh -h

Usage: ./my-demo.sh [options]

  Where options is one or more of:
  -h  Prints Help text
  -d  Debug mode. Disables simulated typing
  -n  No wait
  -w  Waits max the given amount of seconds before proceeding with demo (e.g. `-w5`)

Can be run directly in the terminal or be included in a script like this demo.sh.

I recommend to use it as an include as it allows you to easy make changes / re-play the commands.

#!/bin/sh

########################
# include the magic
########################
. demo-magic.sh

# hide the "evidence"
clear

# Put your stuff here
pei 'docker run --rm grycap/cowsay /usr/games/cowsay "Hello World"'

First try with demo-magic. termtosvg -c "./demo.sh" -g 80x16

termtosvg-02

Now we are getting there!

It simulates input from a keyboard right out of the box.

But it does WAY more than that.

More functions of demo-magic

  • Simulates typing. It looks like you are actually typing out commands.
  • Allows you to actually run commands or pretend to do so.
  • Can hide commands from presentation. Useful for behind the scenes stuff that doesn’t need to be shown.
Faking a network

Can also “fake” network connections even if they are not accessible.

https://github.com/paxtonhare/demo-magic#faking-network-connections

“No waiting”

The -n no wait option can be useful if you want to print and execute multiple commands.

# include demo-magic
. demo-magic.sh -n

# add multiple commands
pe 'git status'
pe 'git log --oneline --decorate -n 20'

However this will oblige you to define your waiting points manually e.g.

...
# define waiting points
pe 'git status'
pe 'git log --oneline --decorate -n 20'
wait
pe 'git pull'
pe 'git log --oneline --decorate -n 20'
wait

So is that it?

Yes, yes i belive this was it for now. I ended up spending waaay more time hunting for the tool that I actually forgot what I was about to record a video off. 🤦🏻‍♂️

Well atleast I got some notes out of it… And now I have some place to start next time I want to record video of my terminal. 🤓