TTYREC(1)
π TTYREC(1) β a tty recorder π
okay bestie, so ttyrec is a tty recorder (yes that's the whole NAME section, it's giving minimal and iconic) and it lives in the User Commands corner of the manual. it records your terminal sessions. that's it. that's the girl. β¨
πΈ SYNOPSIS πΈ
ttyrec [options] -- <command> [command options]
and then there's the legacy compatibility mode, which is like the older sibling who still lives at home:
ttyrec -e <command> [options] [ttyrec file name]
β¨ OPTIONS β¨
so many flags, and honestly? every single one of them is useful. no skips, no cuts, we're doing all of them π
-z,--uuid UUIDβ pick an UUID (and ngl, it can literally be any string, we're not gatekeeping) that'll show up in the ttyrec output file names, and it stays put throughSIGUSR1rotations. default is your own PID.-f,--output FILEβ the full path of the first ttyrec file we write to. skip it and it gets autogenerated for you π-d,--dir FOLDERβ the folder where the ttyrec files go. if you don't say, it's taken from-f, and if you don't say either-for-d, it just defaults to the working directory.-F,--name-format FMTβ your very own customstrftime-compatible format string to qualify the full path of the output files, SIGUSR1-rotated ones included. bespoke. artisanal. π-a,--appendβ open the ttyrec output file in append mode instead of write-clobber mode. no clobbering today, bestie.-Zβ turn on on-the-fly compression if it's available, and silently fall back to no compression if it's not. no drama, no error message, just vibes.--zstdβ force on-the-fly compression of the output file usingzstd. the resulting file will have a.ttyrec.zstextension.--max-flush-time Sβ the maximum number of seconds after which we'll forcezstdto flush its output buffers, so that even somewhat quiet sessions get regularly written out to disk. default is15.-l,--level LEVELβ set the compression level. must be between1and19forzstd, default is3.-n,--count-bytesβ count the number of bytes out and print it on termination. (experimental π)-t,--lock-timeout Sβ lock the session on input timeout afterSseconds.--warn-before-lock Sβ warnSseconds before locking (see--lock-timeout).-k,--kill-timeout Sβ kill the session on input timeout afterSseconds.--warn-before-kill Sβ warnSseconds before killing (see--kill-timeout).-C,--no-cheatcodesβ disable cheat-codes (they're down below π). this is the default.-c,--cheatcodesβ enable cheat-codes (again, see below π).-p,--no-openptyβ don't useopenpty()even when it's available. she said no thank you.-T,--term MODEβMODEcan be either'never'(never allocate a pseudotty, even if stdin is a tty, and use pipes to handle stdout/stderr instead),'always'(always allocate a pseudotty, even if stdin is not a tty) or'auto'(the default β allocate a pseudotty if stdin is a tty, uses pipes otherwise).-v,--verboseβ verbose (debug) mode. use it twice for even more verbosity. double it and give it to the next person.-V,--versionβ show version information.-e,--shell-cmd CMDβ enables legacy compatibility mode and specifies the command to be run under the user's$SHELL -c.
π EXAMPLES π
run some shell commands in legacy mode:
ttyrec -e 'for i in a b c; do echo $i; done' outfile.ttyrec
run some shell commands in normal mode:
ttyrec -f /tmp/normal.ttyrec -- sh -c 'for i in a b c; do echo $i; done'
connect to a remote machine interactively:
ttyrec -t 60 -k 300 -- ssh remoteserver
execute a local script remotely with the default remote shell:
ttyrec -- ssh remoteserver < script.sh
record a screen session:
ttyrec screen
π¦ FOOTNOTES π¦
π Handled signals:
SIGUSR1β close the current ttyrec file and reopen a new one (log rotation).SIGURGβ lock session.SIGUSR2β unlock session.
π Cheat-codes (magic keystrokes combinations):
^L^L^L^L^L^L^L^Lβ lock your session (that's 8 CTRL+L's, count 'em π§).^K^I^L^L^K^I^L^Lβ kill your session. (dramatic but valid π)
π Remark about session lock and session kill:
if we don't have a tty, we can't lock, so-twill be ignored, whereas-kwill be applied without warning, as there's no tty to output a warning to. so like, heads up, bestie. π
and that's the whole page! this one's ttyrec v1.1.5.0, dated June 2019, and it ate, no cap. go record something iconic. π«Άβ¨π
π¦ where this page comes from
- debian trixie: ttyrec 1.1.7.1-1 Β· BSD-3-clause-modified
- ubuntu questing: ttyrec 1.1.7.1-2
- ubuntu resolute: ttyrec 1.1.7.1-2build1 Β· BSD-3-clause-modified
- ubuntu stonking: ttyrec 1.1.7.1-2build1 Β· BSD-3-clause-modified
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms