asciinema-record(1)
π NAME π
okay so, bestie: asciinema-record β record a terminal session. That's the whole name section, it's short and it ate. You're reading the asciinema-record(1) page from the General Commands Manual (section 1, and yes the entry itself is named record β iykyk).
β¨ SYNOPSIS β¨
asciinema record [-f|--output-format] [-c|--command]
[-I|--capture-input] [--capture-env] [-a|--append] [--overwrite]
[-t|--title] [-i|--idle-time-limit] [--headless] [--window-size]
[--return] [--log-file] [-q|--quiet] [-h|--help] <FILE>
π DESCRIPTION π
Record a terminal session to a file. Literally that's it, that's the job. π
It captures all terminal output and optionally keyboard input, saving everything so you can play it back later. It's giving "screen recording but for your terminal" β and it supports various output formats, idle time limiting, and session customization options. Obsessed.
- Press Ctrl+D or type
exitto end the recording session. π«Ά - Press Ctrl+</kbd> to pause/resume capture of the session. β¨
Heads up: during the session, the ASCIINEMA_SESSION environment variable is set to a unique session ID. No cap.
π₯ OPTIONS π₯
like, all of them. no skips, no gatekeeping. π
-f,--output-format=FORMATβ specify the format for the output file. The default isasciicast-v3. If the file path ends with.txt, thetxtformat will be selected automatically β unless--output-formatis explicitly specified (the flag always wins, main character energy).
Possible values:
asciicast-v3: full-featured session format, with timing and metadata (current generation) βhttps://docs.asciinema.org/manual/asciicast/v3/asciicast-v2: full-featured session format, with timing and metadata (previous generation) βhttps://docs.asciinema.org/manual/asciicast/v2/raw: raw terminal output, including control sequences, without timing and metadatatxt: plain text without colors or control sequences, human-readable
-c,--command=COMMANDβ specify the command to execute in the recording session. If you don't provide one, asciinema will use your default shell from the$SHELLenvironment variable. This can be any command with arguments, for example:--command "python script.py"or--command "bash -l". Can also be set via the config file optionsession.command. π-I,--capture-inputβ enable recording of keyboard input in addition to terminal output. When enabled, both what you type and what appears on the screen will be captured.
β οΈ fr fr warning: sensitive input like passwords will also be recorded when this option is enabled. π
Can also be set via the config file option session.capture_input.
--capture-env=VARSβ specify which environment variables to capture and include in the recording metadata. This helps ensure the recording context is preserved, e.g. for auditing. Provide a comma-separated list of variable names, for example:--rec-env "USER,SHELL,TERM"(that's exactly how the example is spelled in the docs, copy-paste bestie). If not specified, only theSHELLvariable is captured by default. Can also be set via the config file optionsession.capture_env. π¦-a,--appendβ append the new session to an existing recording file instead of creating a new one. This allows you to continue a previous recording session. The timing will be adjusted to maintain continuity from where the previous recording ended. Cannot be used together with--overwriteβ pick a side. βοΈ--overwriteβ overwrite the output file if it already exists. By default asciinema will refuse to overwrite existing files, to prevent accidental data loss (it's protecting you, and honestly? valid). Cannot be used together with--append.-t,--title=TITLEβ set a title that will be stored in the recording metadata. This title may be displayed by players and is useful for organizing and identifying recordings. For example:--title "Installing Podman on Ubuntu". π-i,--idle-time-limit=SECSβ limit the maximum idle time recorded between terminal events to the specified number of seconds. Long pauses (such as when you step away from the terminal) will be capped at this duration in the recording, making playback more watchable. For example,--idle-time-limit 2.0will ensure no pause longer than 2 seconds appears in the recording.
π§ note that this option doesn't alter the original (captured) timing information β instead, it embeds the idle time limit value in the metadata, which is interpreted by session players at playback time. This allows tweaking of the limit after recording. Iconic behaviour, honestly.
Can also be set via the config file option session.idle_time_limit.
--headlessβ record in headless mode without using the terminal for input/output. This is useful for automated or scripted recordings where you don't want asciinema to interfere with the current terminal session. The recorded command will still execute normally, but asciinema won't display its output in your terminal. Headless mode is enabled automatically when running in an environment where a terminal is not available. π§--window-size=COLSxROWSβ override the terminal window size used for the recording session. Specify dimensions asCOLSxROWS(e.g.,80x24for 80 columns by 24 rows). You can specify just columns (80x) or just rows (x24) to override only one dimension. This is useful for ensuring consistent recording dimensions regardless of your current terminal size. π--returnβ make theasciinemacommand exit with the same status code as the recorded session. By default,asciinemaexits with status0regardless of what happens in the recorded session. With this option, if the recorded command exits with a non-zero status,asciinemawill also exit with the same status. π―--log-file=PATHβ enable logging of internal events to a file at the specified path. Useful for debugging recording issues. π-q,--quietβ suppress diagnostic messages and progress indicators. Only error messages will be displayed. Peace and quiet, slay. π€«-h,--helpβ print help (see a summary with '-h'). π«Ά<FILE>β output file path.
π EXTRA π
Examples, aka the fun part. Copy these, they're literally ready:
asciinema rec demo.cast
Records a shell session to a file. the classic. β
asciinema rec demo.cast
asciinema rec --command "python script.py" demo.cast
Records execution of a Python script. π
asciinema rec --command "python script.py" demo.cast
asciinema rec --idle-time-limit 2 demo.cast
Records with idle time capped at 2 seconds. no more five-minute "brb" gaps in your cast. π
asciinema rec --idle-time-limit 2 demo.cast
asciinema rec --capture-input --title "API Demo" demo.cast
Records with keyboard input and sets a title. π
asciinema rec --capture-input --title "API Demo" demo.cast
asciinema rec --append demo.cast
Continues recording to an existing file. the way that continuity worksβ¦ π¦
asciinema rec --append demo.cast
asciinema rec demo.txt
Records as a plain-text log β output format inferred from the .txt extension. π
asciinema rec demo.txt
and that's the page, bestie π«Ά β this has been the record entry, asciinema-record(1), living in your General Commands Manual (section 1). go forth and record something iconic. πβ¨π
π¦ where this page comes from
- alpine 3.24: asciinema-doc 3.2.0-r0 Β· GPL-3.0-or-later
- arch rolling: asciinema 3.2.1-1 Β· GPL-3.0-only
- nixos 26.05: asciinema 3.2.0
- nixpkgs unstable: asciinema 3.2.1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms