script

Record all terminal output to file. More information: https://manned.org/script.

script

script path/to/session.out

script -a path/to/session.out

script -t 2> path/to/timingfile