Have you ever watched a terminal demo that lets you select, copy, and paste commands directly from the screen, just like watching magic unfold in a live shell session?
Well, that’s not a traditional video.
What you’re seeing is asciinema, a lightweight, open-source tool that records your terminal sessions as text-based events, not pixels. 🧙♂️✨
🎬 What is asciinema?
asciinema is a terminal session recorder that captures the exact keystrokes and output in your terminal and saves them as time-stamped JSON events.
Unlike traditional screen recording:
-
✅ The file size is tiny
-
✅ The text is selectable and copyable
-
✅ Playback is accurate, timing included
-
✅ It’s open source and embeddable
🧠 How Does It Work?
When you run:
asciinema rec demo.cast
It doesn’t generate an .mp4 or .webm file. Instead, it creates a .cast file — a JSON file that contains:
-
Timestamps ⏱️
-
Terminal output (e.g., stdout)
-
Keystrokes (stdin, optional)
-
Dimensions of the terminal (rows × cols)
Example .cast data:
[ { "version": 2, "width": 80, "height": 24, "timestamp": 1687000000 }, [0.01, "o", "sudo snap install microk8s --classic\n"], [0.50, "o", "Run install hook of \"microk8s\" snap if present\n"] ]
🎯 It’s a replay of structured terminal I/O, not a pixel capture.
🖥️ Why You Can Copy Text From It
Since it’s rendered as text using JavaScript + HTML, you can:
-
🔍 Select and copy text
-
🔄 Interact with the output (scroll, pause, resume)
-
🧩 Embed in web pages like a live snippet
It uses a player component that mimics a terminal but renders HTML text blocks styled like a shell. This allows text interaction just like a real terminal.
🧪 Try It Yourself!
- Install asciinema:
- Record:
- Press Ctrl+D or type exit to finish recording.
- Upload to asciinema.org (optional):
sudo apt install asciinema
asciinema rec mysession.cast
asciinema upload mysession.cast
You’ll get a public link with a web-based terminal player like what MicroK8s shows on https://microk8s.io.
🛠 Use Cases
• 📚 Technical documentation
• 🧑🏫 Tutorials & onboarding
• 🐞 Bug reproduction
• 📦 Open source project demos
🧩 Bonus: Enhance It With svg-term or cast-to-video
If you still want a video:
-
Use svg-term to generate SVG animations
-
Or convert .cast to .mp4 using asciinema2gif or asciinema-player with screen recording
🌍 Real-World Example: MicroK8s Docs
The MicroK8s install page uses this exact trick. Their embedded terminal demos:
-
Looks like real shell sessions
-
Let you copy-paste
-
Load instantly
-
Are accessible across all devices
There is no buffering or pixel blur — just crisp, live, shareable shell demos!
🏁 Summary
Feature |
Video |
asciinema |
---|---|---|
File Size |
Large 📦 |
Tiny 📎 |
Selectable |
❌ |
✅ |
Interactive |
❌ |
✅ |
Open Source |
Not always |
✅ |
SEO Friendly |
❌ |
✅ |
💡 Final Thoughts
If you’re creating terminal-based tutorials or CLI demos, consider replacing static videos with asciinema. It’s more efficient, interactive, and developer-friendly. You’re not just showing — you’re sharing a real experience. 🚀
🔗 Resources
#Terminal #asciinema #Developer #DevOps #Console #Linux #Tips