Recording terminal sessions is an essential skill for developers, educators, and DevOps engineers. Whether you’re creating a tutorial for your team, documenting a deployment procedure, building a demo for a conference talk, or keeping an audit trail of production changes — having a reliable way to capture and replay terminal output is invaluable.
Commercial screen recorders work, but they produce heavy video files, expose your entire desktop, and strip away the text-based nature of terminal content. Dedicated terminal recording tools produce lightweight, searchable, text-based recordings that can be embedded in documentation, shared as interactive players, or converted to GIFs and videos.
In this guide, we compare the three leading open-source terminal recording tools: asciinema, vhs (by Charm), and ttyrec. Each serves a different workflow, and understanding their strengths will help you pick the right tool.
Why Self-Host Terminal Recording
Cloud-based terminal recording services are convenient, but self-hosting offers important advantages:
- Full privacy: Terminal recordings often contain sensitive data — file paths, configuration values, server names, and sometimes credentials. Self-hosting ensures this content never leaves your infrastructure.
- Offline availability: Recordings are stored locally and accessible without an internet connection, which matters for teams in restricted environments or with unreliable connectivity.
- No rate limits or quotas: Free tiers on hosted platforms limit recording length, storage, or views. Self-hosted tools have no artificial limits.
- Custom branding and integration: Self-hosted players can be embedded in your own documentation site with your branding, styling, and access controls.
- Long-term archival: When a cloud service shuts down or changes pricing, your recordings are at risk. Self-hosted recordings are plain text files that will outlive any platform.
asciinema: The Standard for Terminal Recording
asciinema is the most widely adopted terminal recording tool. It records terminal sessions as plain-text cast files that capture every character, timing, and terminal escape sequence. Recordings can be played back in a terminal, embedded as an interactive player on websites, or uploaded to the public asciinema.org service.
How It Works
asciinema attaches to your shell’s pseudo-terminal and records everything that gets printed — text, colors, cursor movements — along with precise timing information. The output is a JSON-formatted .cast file that contains header metadata followed by timestamped events.
Installation
On Debian/Ubuntu:
| |
On macOS with Homebrew:
| |
From PyPI (works everywhere with Python 3):
| |
Recording Your First Session
| |
You now have a live terminal where everything you type and every output line is recorded. When finished, press Ctrl+D or type exit. The file deployment.cast is saved to your working directory.
Play it back:
| |
Share it on asciinema.org (optional):
| |
Self-Hosting the asciinema Server
For complete privacy, run your own asciinema server:
| |
Configure your local asciinema client to use your server by editing ~/.config/asciinema/config:
| |
Then upload as usual — recordings go to your server instead of the public instance.
Embedding Recordings
Once uploaded, embed the player in any HTML page:
| |
Or embed as an iframe for more control:
| |
For static sites like Hugo, include the embed script directly in your Markdown:
| |
Converting to GIF and Video
The agg (asciinema gif generator) tool converts .cast files to animated GIFs:
| |
For MP4 video output, pipe through ffmpeg:
| |
Advanced Usage
Record with metadata and a custom prompt:
| |
Key flags:
| Flag | Purpose |
|---|---|
--command | Override the default shell |
--title | Recording title for metadata |
--idle-time-limit | Cap idle gaps (seconds) to speed up playback |
--env | Comma-separated env vars to include in header |
--append | Append to an existing recording |
--raw | Record raw stdin/stdout (no terminal emulation) |
Pros and Cons
| Strengths | Weaknesses |
|---|---|
| Industry standard — widest tool ecosystem | Upload requires network access (unless self-hosted) |
Plain-text .cast format is human-readable | Player is JavaScript-dependent for web embeds |
| Rich metadata in header (env, terminal size, theme) | No built-in editing — cannot trim or splice recordings |
| Excellent web player with speed control and copy-paste | GIF conversion requires a separate tool (agg) |
| Works across Linux, macOS, and Windows (WSL) | No audio recording — terminal only |
vhs: Terminal Recording as Code
vhs (Video Helper System) by Charm is a fundamentally different approach: instead of recording live sessions, you write a “tape” script that describes the terminal actions, and vhs renders it to GIF, MP4, or WebM. It’s like a screenplay for your terminal.
How It Works
You write a .tape file with instructions — type this command, wait for output, press enter, clear the screen — and vhs executes it in a headless terminal, capturing the result as a high-quality animation. This gives you pixel-perfect, repeatable recordings with no typos or accidental keypresses.
Installation
On Debian/Ubuntu (from .deb):
| |
On macOS with Homebrew:
| |
From Go:
| |
Writing Your First Tape
Create deploy.tape:
| |
Render it:
| |
This produces deploy.gif — a clean, professional terminal animation with no mistakes.
Tape File Syntax
The tape language supports a rich set of commands:
| |
Recording from a Live Session
vhs also supports recording live sessions (similar to asciinema) with the record subcommand:
| |
This captures your typing and converts it to a tape file you can edit and re-render.
CI/CD Integration
vhs shines in CI pipelines because recordings are deterministic and version-controlled:
| |
Docker Deployment for Rendering
Run vhs in a container for consistent rendering across environments:
| |
Self-Hosting a vhs Web API
For teams that want to render tapes via an API, wrap vhs in a lightweight HTTP service:
| |
Run it:
| |
Send a tape for rendering:
| |
Pros and Cons
| Strengths | Weaknesses |
|---|---|
| Deterministic — same tape always produces identical output | Not for live recording workflows |
| Version-controlled recordings — tapes are plain text | Requires writing scripts instead of just hitting record |
| Beautiful output — Charm’s themes are production-quality | Heavier dependencies (needs a TTY environment) |
| CI/CD friendly — render on every commit | Less flexible for spontaneous recording |
| Multiple output formats (GIF, MP4, WebM, PNG) | No interactive web player for .cast-style playback |
| No typos — edit the tape before rendering | Smaller ecosystem than asciinema |
ttyrec: The Minimalist Terminal Recorder
ttyrec is the original Unix terminal recording tool, dating back decades. It’s a tiny C program that records raw terminal I/O to a file. No JSON, no metadata, no web players — just bytes.
How It Works
ttyrec wraps a shell session and records the raw terminal output stream to a file. The format is a simple binary structure: each event is a timestamp followed by the raw data bytes. It’s the most lightweight option but requires additional tools for playback and conversion.
Installation
On Debian/Ubuntu:
| |
From source:
| |
Basic Usage
Record a session:
| |
Everything you type and see is recorded to session.log. Press Ctrl+D to stop.
Play it back at normal speed:
| |
Play at 2x speed:
| |
Play with a custom speed function (e.g., skip idle time):
| |
Converting to Text
Extract plain text from a ttyrec recording:
| |
Convert to asciinema format:
| |
Docker Usage
| |
Pros and Cons
| Strengths | Weaknesses |
|---|---|
| Smallest footprint — tiny binary, zero dependencies | Raw binary format — not human-readable |
| Works on any Unix system | No built-in web player |
| Battle-tested — used for decades in production | No metadata (no terminal size, env, or title) |
| Extremely low overhead during recording | Playback tools are basic |
| Ideal for audit logging and compliance | Requires conversion for modern sharing |
Feature Comparison
| Feature | asciinema | vhs | ttyrec |
|---|---|---|---|
| Recording mode | Live session | Scripted (tape) | Live session |
| Output format | JSON .cast | GIF/MP4/WebM/PNG | Binary log |
| File size | Small (text) | Medium (media) | Smallest (binary) |
| Human-readable | Yes | Partially (tape) | No |
| Web player | Built-in | No | No |
| Editing support | No (trim with external tools) | Yes (edit tape) | No |
| Deterministic | No (live typing) | Yes (scripted) | No (live typing) |
| CI/CD friendly | Moderate | Excellent | Low |
| Self-hostable server | Yes (asciinema-server) | Via API wrapper | N/A |
| Audio | No | No | No |
| Color support | Full ANSI | Full ANSI | Full ANSI |
| Idle time control | --idle-time-limit | Sleep commands | Via playback speed |
| Dependencies | Python 3 | Go runtime | C stdlib only |
| Learning curve | Low | Medium | Low |
Choosing the Right Tool
Pick asciinema if:
- You want to record live sessions with minimal effort
- You need an interactive web player for documentation
- You want the widest compatibility and ecosystem support
- You need to share recordings as embeddable content
- You prefer a simple
rec/playworkflow
Pick vhs if:
- You need pixel-perfect, typo-free recordings for presentations
- You want version-controlled, reproducible terminal demos
- You’re building documentation that renders in CI/CD pipelines
- You value beautiful aesthetics with built-in themes
- You create terminal tutorials that need to be updated frequently
Pick ttyrec if:
- You need the absolute lightest-weight recording tool
- You’re recording for audit logs or compliance purposes
- You work on minimal systems where installing Python or Go is impractical
- You want to pipe recordings into custom processing pipelines
- You need maximum compatibility with legacy Unix systems
Practical Workflows
Documenting a Deployment Procedure
| |
Creating a Tutorial Series with vhs
| |
Render all tutorials in one command:
| |
Audit Logging with ttyrec
| |
Review yesterday’s root sessions:
| |
Security Considerations
Terminal recordings are sensitive data. Follow these practices:
Sanitize before sharing: Never share recordings that contain credentials, tokens, or internal hostnames. Use
--hidein vhs or post-process.castfiles to redact sensitive output.Encrypt stored recordings: If recordings contain production data, encrypt them at rest:
| |
- Set access controls: On self-hosted asciinema servers, require authentication and use role-based access:
| |
- Audit what you record: When using ttyrec for compliance, define retention policies:
| |
- Avoid recording interactive prompts: If a command prompts for a password, the password will be recorded. Use non-interactive flags (
--non-interactive,-y) or environment variables instead.
Conclusion
Terminal recording tools fill a gap that general-purpose screen recorders cannot: capturing the text-based, interactive nature of the command line in a format that’s lightweight, searchable, and easy to share. asciinema is the go-to choice for live recording with web playback, vhs delivers scripted, pixel-perfect animations ideal for documentation and CI/CD, and ttyrec provides the most minimal, dependency-free recording for audit and compliance.
For most development teams, running asciinema with a self-hosted server provides the best balance of ease and control. Teams building public-facing documentation will find vhs’s scripted approach produces the most professional results. Organizations with compliance requirements should use ttyrec for its simplicity and low overhead.
All three tools are free, open-source, and can be integrated into your existing workflow. Start recording your terminal sessions today — your future self will thank you when it’s time to debug, document, or demo.
Frequently Asked Questions (FAQ)
Which one should I choose in 2026?
The best choice depends on your specific requirements:
- For beginners: Start with the simplest option that covers your core use case
- For production: Choose the solution with the most active community and documentation
- For teams: Look for collaboration features and user management
- For privacy: Prefer fully open-source, self-hosted options with no telemetry
Refer to the comparison table above for detailed feature breakdowns.
Can I migrate between these tools?
Most tools support data import/export. Always:
- Backup your current data
- Test the migration on a staging environment
- Check official migration guides in the documentation
Are there free versions available?
All tools in this guide offer free, open-source editions. Some also provide paid plans with additional features, priority support, or managed hosting.
How do I get started?
- Review the comparison table to identify your requirements
- Visit the official documentation (links provided above)
- Start with a Docker Compose setup for easy testing
- Join the community forums for troubleshooting