Skip to main content
The record command records a terminal session as an asciicast file, which can be replayed later or shared with others.

Synopsis

Description

Records a terminal session using the asciicast v2 format. This creates a recording of all terminal output with precise timing information, which can be replayed with the wezterm replay command or other asciicast-compatible players. The recording captures:
  • All terminal output (escape sequences, colors, formatting)
  • Timing information for accurate playback
  • Terminal dimensions
  • Environment information
  • Color palette

Arguments

string[]
Start PROG instead of the default_prog defined by your WezTerm configuration.If omitted, the default shell configured in your wezterm.lua will be used.Example:

Options

path
Start in the specified directory, instead of the default_cwd defined by your WezTerm configuration.Example:
path
Save asciicast to the specified file.If omitted, a random file name will be created in the temp directory with the pattern wezterm-recording-*.cast.txt.Example:

How It Works

  1. When you run wezterm record, it starts recording immediately
  2. You interact with the terminal normally
  3. All output is captured with timing information
  4. When you exit the shell (Ctrl-D or exit), recording stops
  5. The asciicast file is saved to the specified location

Examples

Basic recording

This creates a recording in a temp file. The path will be displayed when you exit:

Record to specific file

Record a specific program

Record with specific working directory

Record a Python script

Record a specific command sequence

Record system diagnostics

Asciicast Format

The recording is saved in asciicast v2 format, which is a JSON-lines file:

Header (first line)

Event lines

Each event line contains:
  1. Timestamp (seconds since start)
  2. Event type (“o” for output)
  3. Data (the actual output)

Use Cases

Creating Tutorials

Record terminal sessions for documentation:

Bug Reports

Capture terminal output for bug reports:

Code Demos

Record demos of your CLI tools:

Training Materials

Create training recordings:

Testing

Record test sessions for later analysis:

Tips

Script your recordings

For consistent recordings, use a script:

Control timing

Add pauses for better viewing:

Clean output

Set a simple prompt for cleaner recordings:

Combine with replay

Test your recording immediately:

Sharing Recordings

Asciicast files can be:
  1. Replayed locally:
  2. Uploaded to asciinema.org:
  3. Embedded in documentation: Use asciinema-player to embed in web pages
  4. Converted to GIF: Use tools like agg or asciicast2gif
  5. Shared as files: The .cast files are plain text and can be committed to git

File Size Considerations

Asciicast files are text-based and usually quite small:
  • Short sessions: 1-10 KB
  • Medium sessions: 10-100 KB
  • Long sessions: 100 KB - 1 MB
The file size depends on:
  • Duration of recording
  • Amount of output
  • Complexity of output (colors, formatting)

Privacy Note

Recordings capture all terminal output. Be careful not to record:
  • Passwords or API keys
  • Sensitive file contents
  • Private information
Always review recordings before sharing!

Stopping a Recording

To stop recording:
  • Type exit in the shell
  • Press Ctrl-D
  • The program you’re recording exits naturally
The recording will be saved and the location will be printed: