TTYREC(1)

πŸ“¦
version 1.1.7.1 Β· 2 versions
, in debian trixie, ubuntu questing, ubuntu resolute, ubuntu stonking

πŸ’– 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 through SIGUSR1 rotations. 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 -f or -d, it just defaults to the working directory.
  • -F, --name-format FMT β€” your very own custom strftime-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 using zstd. the resulting file will have a .ttyrec.zst extension.
  • --max-flush-time S β€” the maximum number of seconds after which we'll force zstd to flush its output buffers, so that even somewhat quiet sessions get regularly written out to disk. default is 15.
  • -l, --level LEVEL β€” set the compression level. must be between 1 and 19 for zstd, default is 3.
  • -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 after S seconds.
  • --warn-before-lock S β€” warn S seconds before locking (see --lock-timeout).
  • -k, --kill-timeout S β€” kill the session on input timeout after S seconds.
  • --warn-before-kill S β€” warn S seconds 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 use openpty() even when it's available. she said no thank you.
  • -T, --term MODE β€” MODE can 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 -t will be ignored, whereas -k will 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