Make a typescript file of a terminal session.
# To start recording in file named "typescript":
script
# To stop recording:
exit
# To start recording in a given file:
script <logfile.log>
# To append to an existing file:
script -a <logfile.log>
# To execute quietly without start and done messages:
script -q <logfile.log>
# ---
# To remove escaped color codes sequences from the generated output file (https://unix.stackexchange.com/a/14699):
cat <typescript> | sed -e "s/\x1b\[.\{1,5\}m//g"