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 thewezterm 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
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
Start in the specified directory, instead of the
default_cwd defined by your WezTerm configuration.Example: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
- When you run
wezterm record, it starts recording immediately - You interact with the terminal normally
- All output is captured with timing information
- When you exit the shell (Ctrl-D or
exit), recording stops - The asciicast file is saved to the specified location
Examples
Basic recording
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
- Timestamp (seconds since start)
- Event type (“o” for output)
- 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:-
Replayed locally:
-
Uploaded to asciinema.org:
- Embedded in documentation: Use asciinema-player to embed in web pages
-
Converted to GIF:
Use tools like
aggorasciicast2gif -
Shared as files:
The
.castfiles 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
- Duration of recording
- Amount of output
- Complexity of output (colors, formatting)
Privacy Note
Stopping a Recording
To stop recording:- Type
exitin the shell - Press Ctrl-D
- The program you’re recording exits naturally
Related
- wezterm replay - Replay asciicast recordings
- wezterm start - Start a terminal session
- Asciicast v2 Format Specification