Record all terminal output to a typescript file. More information: https://manned.org/script.
typescript in the current directory:script
exit
script {{path/to/session.out}}
script {{[-a|--append]}} {{logfile.log}}
stderr):script {{[-t|--timing]}} 2> {{path/to/timing_file}}
script {{[-f|--flush]}} {{path/to/file}}
script {{[-q|--quiet]}} {{logfile.log}}
script {{[-h|--help]}}