Almost every lab in this course ends with a question like: "submit a transcript of your work showing the commands you ran and the output you got." The traditional answers — copy-pasting into a Word document, taking screenshots, retyping from memory — are slow and error-prone. The professional answer is to record the session.
This page covers three tools that record terminal sessions: script (built into every Linux system), asciinema (modern, web-shareable, requires install), and ttyrec (the historical predecessor that's still worth knowing). Plus the practical bit: how to print or share the recording when the lab is done.
Why record a session
- Exact transcripts, no typos. Every command you ran and every byte of output, verbatim. No reconstruction from memory.
- Reproducible deliverables. Your TA or instructor can replay the session at the exact speed you ran it — or speed-scrub to the relevant moment.
- Debugging. When something goes wrong, the recording shows exactly what happened. No "I think I typed…"
- Documentation. Records of how something was set up become the runbook for the next person to do it.
- Forensics & incident response. When you're investigating something live, a session recording is evidence. Auditors love them.
Tool 1 — script: the built-in
script — record any session, no install
script is part of util-linux — the same package that gives you mount and su. It's been on every Unix system since the early 1980s. You will never be on a Linux box that doesn't have it.
Start a recording
From this point on, everything you type and everything you see is captured to that file. Run your lab work normally.
Stop the recording
You can also run a single command and capture just that:
Read the recording
The output file is plain text with embedded ANSI color codes. Open it with any text editor or pager:
Record with timing — for replay
To replay the session at the speed you typed it, capture timing data too:
This is the magic trick. scriptreplay turns your recording into a movie. Pair it with --divisor 4 to play back 4x faster, useful when you ran a long-running command and want the highlights.
Practical day-of-class workflow
At the end of the day, both files are sitting in ~/cyberlab/, dated. To submit: attach the .log file (the transcript). To replay later: scriptreplay with both files.
Tool 2 — asciinema: the modern share-friendly option
asciinema — record & share to the web
Where script produces a text file, asciinema produces a small JSON file that captures every keystroke with precise timing. The same recording can be replayed in a terminal, embedded in a web page, or exported as an animated SVG — without any video file or screen capture.
Install
Record & play locally
Upload & share
The recording is hosted publicly (or unlisted) on asciinema.org. You get a URL you can paste into a lab report, an issue, a doc — the viewer plays the recording inline in any browser. This is the modern equivalent of "screenshot the terminal," except the viewer can scrub the timeline and copy text out of the playback.
Export as SVG (animated, embeddable, printable)
The .svg file animates in any browser, embeds in markdown, and prints to PDF cleanly. Great for documentation that has to live in a doc system that doesn't render asciinema URLs.
--quiet to skip the upload prompt, or upload as unlisted with the web UI. For sensitive lab work, prefer script + local file submission — nothing leaves your machine.Tool 3 — ttyrec: the historical option
ttyrec — the classic Unix tty recorder
ttyrec predates asciinema by 13 years and is still installed on many older Linux systems. It records to a binary format and plays back with ttyplay. Less polished than asciinema; smaller files; still useful when you're on a stripped-down system where you can install one small package.
Most modern courses use script or asciinema. ttyrec is mentioned here mainly so you recognize it when you encounter a .ttyrec file in the wild.
Pick one — the comparison
Which tool fits which job
| script | asciinema | ttyrec | |
|---|---|---|---|
| Pre-installed | Yes (everywhere) | No (apt/dnf/brew) | No |
| Output is human-readable | Yes (plain text) | JSON | Binary |
| Web-shareable URL | No | Yes (asciinema.org) | No |
| Embeddable in browser | No | Yes (player + SVG) | No |
| Timing preserved for replay | Yes (with --timing) | Yes (built in) | Yes |
| File size for 10-min session | ~50 KB | ~20 KB | ~30 KB |
| Easy to grep / search through | Yes (text) | Partial (JSON has the text inside) | No |
For this course: use script by default. It's everywhere, the output is plain text you can submit directly, and it requires zero setup. Reach for asciinema when you want a polished playback experience or want to share a recording with a URL.
Turning a recording into a deliverable
Once you have the recording, the lab usually wants something you can submit through the LMS. Three patterns cover essentially every case:
Pattern 1: submit the raw transcript
For script output, the file is already plain text. Attach the .txt file to your submission.
Pattern 2: print to PDF
If the LMS wants a single document, convert the transcript to PDF. Two easy ways:
Pattern 3: paste a clean copy into a writeup
For partial transcripts (just the interesting commands), strip the ANSI color codes and paste into your writeup document:
That sed incantation removes ANSI escape sequences. The result is plain text, ready to paste into a markdown file, a Word doc, or a Brightspace text field.
script ~/cyberlab/$(date +%F).log. Do your work. At the end of class, you have a dated transcript of everything. Pull out the commands you want to submit, attach the file as appendix evidence, and move on with your day. The labs that ask "show me what you typed" become five minutes of work instead of an hour of reconstruction.Recording your terminal session takes one extra command at the start of the lab and one at the end. The payoff is enormous: exact transcripts, replayable on demand, printable as PDFs, shareable as URLs. Every lab in this course that asks for a transcript gets easier the day you start using one of these tools.
Use script by default. Add asciinema when you want web-shareable playback. Both belong in the muscle memory of any Linux user serious about their work.
References
Formatted in APA 7. Alphabetized by first author's last name.
- asciinema. (n.d.). asciinema: Record and share your terminal sessions. https://asciinema.org/
- Kerrisk, M. (n.d.-a). script(1): Linux manual page. Linux man-pages project. https://man7.org/linux/man-pages/man1/script.1.html
- Kerrisk, M. (n.d.-b). scriptreplay(1): Linux manual page. Linux man-pages project. https://man7.org/linux/man-pages/man1/scriptreplay.1.html
- Marc'O. (n.d.). ttyrec: A tty recorder. https://0xcc.net/ttyrec/
- Sitnikovski, M. (n.d.). svg-term-cli: Share terminal sessions via animated SVG [Source code]. GitHub. https://github.com/marionebl/svg-term-cli